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

Eric Blake eblake at redhat.com
Thu Dec 23 15:56:03 UTC 2010


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 at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101223/cdc97952/attachment-0001.sig>


More information about the libvir-list mailing list