mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
threadpool: Don't wait on condition if pool has no workers
Pool creates new workers dynamically. However, it is possible for a pool to have no workers. If we want to free that pool, we don't want to wait on quit condition as it will never be signaled.
This commit is contained in:
parent
2d5046d31f
commit
3b0bb65dd4
@ -258,7 +258,8 @@ void virThreadPoolFree(virThreadPoolPtr pool)
|
||||
virCondBroadcast(&pool->prioCond);
|
||||
}
|
||||
|
||||
ignore_value(virCondWait(&pool->quit_cond, &pool->mutex));
|
||||
if (pool->nWorkers > 0 || pool->nPrioWorkers > 0)
|
||||
ignore_value(virCondWait(&pool->quit_cond, &pool->mutex));
|
||||
|
||||
while ((job = pool->jobList.head)) {
|
||||
pool->jobList.head = pool->jobList.head->next;
|
||||
|
Loading…
x
Reference in New Issue
Block a user