[PATCH 4/6] virThreadPoolFree: Join worker threads

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

 



Even though currently we are freeing the pool of worker threads at the
daemon very end, nothing holds us back in joining the worker threads.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/util/virthreadpool.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index b1e2c0c..99f36ec 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -241,6 +241,9 @@ void virThreadPoolFree(virThreadPoolPtr pool)
 {
     virThreadPoolJobPtr job;
     bool priority = false;
+    size_t i;
+    size_t nWorkers = pool->nWorkers;
+    size_t nPrioWorkers = pool->nPrioWorkers;
 
     if (!pool)
         return;
@@ -262,6 +265,12 @@ void virThreadPoolFree(virThreadPoolPtr pool)
         VIR_FREE(job);
     }
 
+    for (i = 0; i < nWorkers; i++)
+        virThreadJoin(&pool->workers[i]);
+
+    for (i = 0; i < nPrioWorkers; i++)
+        virThreadJoin(&pool->prioWorkers[i]);
+
     VIR_FREE(pool->workers);
     virMutexUnlock(&pool->mutex);
     virMutexDestroy(&pool->mutex);
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]