Re: [PATCH 1/2] Add a parameter to virThreadPoolSendJob() to let the caller decide whether to wait for the job to complete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/23/2010 02:07 AM, Hu Tao wrote:
> ---

No commit message besides the title?

> @@ -188,9 +193,14 @@ void virThreadPoolFree(virThreadPoolPtr pool)
>  }
>  
>  int virThreadPoolSendJob(virThreadPoolPtr pool,
> -                         void *jobData)
> +                         void *jobData,
> +                         bool waitForCompletion)
>  {

This doesn't make sense to me.  If you know you want to wait for a
function to finish, then call the function directly rather than creating
a job and passing it off to another thread just to block on that thread.

> +++ b/src/util/threadpool.h
> @@ -41,7 +41,8 @@ virThreadPoolPtr virThreadPoolNew(size_t minWorkers,
>  void virThreadPoolFree(virThreadPoolPtr pool);
>  
>  int virThreadPoolSendJob(virThreadPoolPtr pool,
> -                         void *jobdata) ATTRIBUTE_NONNULL(1)
> +                         void *jobdata,
> +                         bool waitForCompletion) ATTRIBUTE_NONNULL(1)
>                                          ATTRIBUTE_NONNULL(2)
>                                          ATTRIBUTE_RETURN_CHECK;

Whether or not you can convince me why this patch is necessary, there's
an independent bug - jobdata is supposed to be opaque, which means it is
acceptable to pass NULL as a jobdata, so we should remove the
ATTRIBUTE_NONNULL(2).

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]