]> xenbits.xensource.com Git - libvirt.git/commitdiff
threadpool: Use while loop on virCondWait
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 9 Dec 2011 16:23:47 +0000 (17:23 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 9 Dec 2011 18:33:11 +0000 (19:33 +0100)
instead of simple 'if' statement as virCondWait can return
even if associated condition was not signaled.

src/util/threadpool.c

index 883d1e5bddd856e479b7caa8c0ab7b77a6232300..e8689d96648efdc73f66b11acef6d92fd35c6d04 100644 (file)
@@ -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));
 
     while ((job = pool->jobList.head)) {