[libvirt] [PATCH] virThreadPool: Don't create joinable threads

Michal Privoznik mprivozn at redhat.com
Wed Dec 4 12:46:54 UTC 2013


Otherwise these threads won't clean after themselves,
as we are not joining them:

==26697== 1,680 bytes in 5 blocks are possibly lost in loss record 913 of 942
==26697==    at 0x4C2BDE4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26697==    by 0x4011131: allocate_dtv (in /lib64/ld-2.16.so)
==26697==    by 0x401176D: _dl_allocate_tls (in /lib64/ld-2.16.so)
==26697==    by 0x8499602: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.16.so)
==26697==    by 0x52F53E9: virThreadCreate (virthreadpthread.c:188)
==26697==    by 0x52F5D4F: virThreadPoolNew (virthreadpool.c:221)
==26697==    by 0x53F30DB: virNetServerNew (virnetserver.c:377)
==26697==    by 0x11C6ED: main (libvirtd.c:1366)

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/util/virthreadpool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index b1e2c0c..cb9e390 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -197,7 +197,7 @@ virThreadPoolPtr virThreadPoolNew(size_t minWorkers,
         data->cond = &pool->cond;
 
         if (virThreadCreate(&pool->workers[i],
-                            true,
+                            false,
                             virThreadPoolWorker,
                             data) < 0) {
             goto error;
@@ -219,7 +219,7 @@ virThreadPoolPtr virThreadPoolNew(size_t minWorkers,
             data->priority = true;
 
             if (virThreadCreate(&pool->prioWorkers[i],
-                                true,
+                                false,
                                 virThreadPoolWorker,
                                 data) < 0) {
                 goto error;
@@ -319,7 +319,7 @@ int virThreadPoolSendJob(virThreadPoolPtr pool,
         data->cond = &pool->cond;
 
         if (virThreadCreate(&pool->workers[pool->nWorkers - 1],
-                            true,
+                            false,
                             virThreadPoolWorker,
                             data) < 0) {
             VIR_FREE(data);
-- 
1.8.4.4




More information about the libvir-list mailing list