From 946a25274c46ffff46323c62f567ae7e753aa921 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 14 Jan 2020 12:34:09 +0000 Subject: [PATCH] util: switch to use the GLib event loop impl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This sets the GLib event loop as the impl when calling virEventRegisterDefaultImpl(). This remains a private impl detail of libvirt, so applications must *NOT* assume that a call to virEventRegisterDefaultImpl() results in a GLib based event loop. They should continue to use the libvirt-glib API gvir_event_register() if they explicitly want to guarantee a GLib event loop. This follows the general principal that the libvirt public API should not expose the fact that GLib is being used internally. Reviewed-by: Pavel Hrdina Signed-off-by: Daniel P. Berrangé --- src/util/virevent.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/util/virevent.c b/src/util/virevent.c index fd5d8f5bf1..3477d63554 100644 --- a/src/util/virevent.c +++ b/src/util/virevent.c @@ -22,7 +22,7 @@ #include #include "virevent.h" -#include "vireventpoll.h" +#include "vireventglib.h" #include "virlog.h" #include "virerror.h" @@ -309,17 +309,7 @@ int virEventRegisterDefaultImpl(void) virResetLastError(); - if (virEventPollInit() < 0) { - virDispatchError(NULL); - return -1; - } - - virEventRegisterImpl(virEventPollAddHandle, - virEventPollUpdateHandle, - virEventPollRemoveHandle, - virEventPollAddTimeout, - virEventPollUpdateTimeout, - virEventPollRemoveTimeout); + virEventGLibRegister(); return 0; } @@ -350,10 +340,5 @@ int virEventRunDefaultImpl(void) VIR_DEBUG("running default event implementation"); virResetLastError(); - if (virEventPollRunOnce() < 0) { - virDispatchError(NULL); - return -1; - } - - return 0; + return virEventGLibRunOnce(); } -- 2.39.5