[libvirt] [PATCH 04/18] qemuMonitorTestFree: Join worker thread unconditionally

Daniel P. Berrange berrange at redhat.com
Wed Oct 2 17:24:35 UTC 2013


On Wed, Oct 02, 2013 at 07:09:53PM +0200, Michal Privoznik wrote:
> The thread needs to be joined no matter if it was still running when
> qemuMonitorTestFree is called or not. The worker is thread spawned in
> qemuMonitorTestNew() and has to be joined.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  tests/qemumonitortestutils.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
> index cd43c7b..4989183 100644
> --- a/tests/qemumonitortestutils.c
> +++ b/tests/qemumonitortestutils.c
> @@ -354,8 +354,7 @@ qemuMonitorTestFree(qemuMonitorTestPtr test)
>  
>      virObjectUnref(test->vm);
>  
> -    if (test->running)
> -        virThreadJoin(&test->thread);
> +    virThreadJoin(&test->thread);
>  
>      if (timer != -1)
>          virEventRemoveTimeout(timer);

qemuMonitorTestNew() will call virMonitorTestFree() from an
'error' label and this label can be reached even from places
where virThreadCreate was not yet run. So I think this will
cause a hang in those cases.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list