From a7adac3730d2e5c83b9c29a0f2a3dd737a33e593 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 9 Dec 2011 17:23:47 +0100 Subject: [PATCH] threadpool: Use while loop on virCondWait instead of simple 'if' statement as virCondWait can return even if associated condition was not signaled. --- src/util/threadpool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/threadpool.c b/src/util/threadpool.c index 883d1e5bdd..e8689d9664 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)); while ((job = pool->jobList.head)) {