提交 2d670cd4 编写于 作者: M Michal Privoznik

qemuMonitorTestFree: Join worker thread

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: NMichal Privoznik <mprivozn@redhat.com>
上级 555b0420
...@@ -51,6 +51,7 @@ struct _qemuMonitorTest { ...@@ -51,6 +51,7 @@ struct _qemuMonitorTest {
bool json; bool json;
bool quit; bool quit;
bool running; bool running;
bool started;
char *incoming; char *incoming;
size_t incomingLength; size_t incomingLength;
...@@ -354,7 +355,7 @@ qemuMonitorTestFree(qemuMonitorTestPtr test) ...@@ -354,7 +355,7 @@ qemuMonitorTestFree(qemuMonitorTestPtr test)
virObjectUnref(test->vm); virObjectUnref(test->vm);
if (test->running) if (test->started)
virThreadJoin(&test->thread); virThreadJoin(&test->thread);
if (timer != -1) if (timer != -1)
...@@ -846,7 +847,7 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test) ...@@ -846,7 +847,7 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test)
virMutexUnlock(&test->lock); virMutexUnlock(&test->lock);
goto error; goto error;
} }
test->running = true; test->started = test->running = true;
virMutexUnlock(&test->lock); virMutexUnlock(&test->lock);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册