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 <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2020-01-14 12:34:09 +00:00
parent f8ab47cb44
commit 946a25274c

View File

@ -22,7 +22,7 @@
#include <config.h>
#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();
}