On Tue, Jul 14, 2020 at 12:32:57PM +0300, Nikolay Shirokovskiy wrote:
virEventThreadClose is used when event loop thread should
be exited synchronously (which is not the case when event loop
is just unreferenced).
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/libvirt_private.syms | 1 +
src/util/vireventthread.c | 9 +++++++++
src/util/vireventthread.h | 1 +
3 files changed, 11 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index f64b1de..c85ec43 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2023,6 +2023,7 @@ virEventGLibRunOnce;
# util/vireventthread.h
+virEventThreadClose;
virEventThreadGetContext;
virEventThreadNew;
diff --git a/src/util/vireventthread.c b/src/util/vireventthread.c
index cf86592..0a7c436 100644
--- a/src/util/vireventthread.c
+++ b/src/util/vireventthread.c
@@ -183,6 +183,15 @@ virEventThreadNew(const char *name)
}
+void
+virEventThreadClose(virEventThread *evt)
+{
+ g_main_loop_quit(evt->loop);
+ g_thread_join(evt->thread);
+ evt->thread = NULL;
+}
Lets invoke this from vir_event_thread_finalize too.
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|