[libvirt] [PATCH 2/2] threadpool: Use while loop on virCondWait

Eric Blake eblake at redhat.com
Fri Dec 9 16:41:49 UTC 2011


On 12/09/2011 09:29 AM, Michal Privoznik wrote:
> instead of simple 'if' statement as virCondWait can return
> even if associated condition was not signaled.
> ---
>  src/util/threadpool.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/threadpool.c b/src/util/threadpool.c
> index 883d1e5..e8689d9 100644
> --- a/src/util/threadpool.c
> +++ b/src/util/threadpool.c
> @@ -258,7 +258,7 @@ void virThreadPoolFree(virThreadPoolPtr pool)
>          virCondBroadcast(&pool->prioCond);
>      }
>  
> -    if (pool->nWorkers > 0 || pool->nPrioWorkers > 0)
> +    while (pool->nWorkers > 0 || pool->nPrioWorkers > 0)
>          ignore_value(virCondWait(&pool->quit_cond, &pool->mutex));

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list