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

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



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

Attachment: signature.asc
Description: OpenPGP digital signature


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