mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
parent
f8ab47cb44
commit
946a25274c
@ -22,7 +22,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "virevent.h"
|
#include "virevent.h"
|
||||||
#include "vireventpoll.h"
|
#include "vireventglib.h"
|
||||||
#include "virlog.h"
|
#include "virlog.h"
|
||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
|
|
||||||
@ -309,17 +309,7 @@ int virEventRegisterDefaultImpl(void)
|
|||||||
|
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
|
|
||||||
if (virEventPollInit() < 0) {
|
virEventGLibRegister();
|
||||||
virDispatchError(NULL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
virEventRegisterImpl(virEventPollAddHandle,
|
|
||||||
virEventPollUpdateHandle,
|
|
||||||
virEventPollRemoveHandle,
|
|
||||||
virEventPollAddTimeout,
|
|
||||||
virEventPollUpdateTimeout,
|
|
||||||
virEventPollRemoveTimeout);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -350,10 +340,5 @@ int virEventRunDefaultImpl(void)
|
|||||||
VIR_DEBUG("running default event implementation");
|
VIR_DEBUG("running default event implementation");
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
|
|
||||||
if (virEventPollRunOnce() < 0) {
|
return virEventGLibRunOnce();
|
||||||
virDispatchError(NULL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user