mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
vireventthread: exit thread synchronously on finalize
It it useful to be sure no thread is running after we drop all references to virEventThread. Otherwise in order to avoid crashes we need to synchronize some other way or we make extra references in event handler callbacks to all the object in use. And some of them are not prepared to be refcounted. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
5c0cd375d1
commit
f4fc3db920
@ -43,6 +43,7 @@ vir_event_thread_finalize(GObject *object)
|
||||
|
||||
if (evt->thread) {
|
||||
g_main_loop_quit(evt->loop);
|
||||
g_thread_join(evt->thread);
|
||||
g_thread_unref(evt->thread);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user