[libvirt PATCH v3 5/7] util: switch to use the GLib event loop impl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 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 <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();
 }
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux