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:
Nikolay Shirokovskiy 2020-07-23 10:23:00 +03:00
parent 5c0cd375d1
commit f4fc3db920

View File

@ -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);
}