From: Daniel P. Berrangé Date: Tue, 14 Jan 2020 12:34:09 +0000 (+0000) Subject: util: switch to use the GLib event loop impl X-Git-Tag: v6.1.0-rc1~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=946a25274c46ffff46323c62f567ae7e753aa921;p=thirdparty%2Flibvirt.git util: switch to use the GLib event loop impl 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é --- 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(); }