[PATCH v2 1/5] qemuMonitorTestFree: Join worker thread

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

 



Join the worker thread no matter if it is running or zombie already.
With current implementation the thread is joined iff @running is true.
However, when worker executes the last line, @running is set to false.
Hence qemuMonitorTestFree() won't join it (and free resources) even
though we can clearly see worker has run (nobody else sets @running =
false).

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/qemumonitortestutils.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index cd43c7b..2aefabc 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -51,6 +51,7 @@ struct _qemuMonitorTest {
     bool json;
     bool quit;
     bool running;
+    bool started;
 
     char *incoming;
     size_t incomingLength;
@@ -354,7 +355,7 @@ qemuMonitorTestFree(qemuMonitorTestPtr test)
 
     virObjectUnref(test->vm);
 
-    if (test->running)
+    if (test->started)
         virThreadJoin(&test->thread);
 
     if (timer != -1)
@@ -846,7 +847,7 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test)
         virMutexUnlock(&test->lock);
         goto error;
     }
-    test->running = true;
+    test->started = test->running = true;
     virMutexUnlock(&test->lock);
 
     return 0;
-- 
1.8.1.5

--
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]