[PATCH 36/43] util: virnetlink: convert virMutex to GMutex

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

 



Signed-off-by: Rafael Fonseca <r4f4rfs@xxxxxxxxx>
---
 src/util/virnetlink.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 3117dcbe65..e9f2c273d9 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -62,7 +62,7 @@ typedef struct _virNetlinkEventSrvPrivate virNetlinkEventSrvPrivate;
 typedef virNetlinkEventSrvPrivate *virNetlinkEventSrvPrivatePtr;
 struct _virNetlinkEventSrvPrivate {
     /* Server */
-    virMutex lock;
+    GMutex lock;
     int eventwatch;
     int netlinkfd;
     virNetlinkHandle *netlinknh;
@@ -791,13 +791,13 @@ virNetlinkGetErrorCode(struct nlmsghdr *resp, unsigned int recvbuflen)
 static void
 virNetlinkEventServerLock(virNetlinkEventSrvPrivatePtr driver)
 {
-    virMutexLock(&driver->lock);
+    g_mutex_lock(&driver->lock);
 }
 
 static void
 virNetlinkEventServerUnlock(virNetlinkEventSrvPrivatePtr driver)
 {
-    virMutexUnlock(&driver->lock);
+    g_mutex_unlock(&driver->lock);
 }
 
 /**
@@ -916,7 +916,7 @@ virNetlinkEventServiceStop(unsigned int protocol)
     VIR_FREE(srv->handles);
     virNetlinkEventServerUnlock(srv);
 
-    virMutexDestroy(&srv->lock);
+    g_mutex_clear(&srv->lock);
     VIR_FREE(srv);
     return 0;
 }
@@ -1017,10 +1017,7 @@ virNetlinkEventServiceStart(unsigned int protocol, unsigned int groups)
     if (VIR_ALLOC(srv) < 0)
         return -1;
 
-    if (virMutexInit(&srv->lock) < 0) {
-        VIR_FREE(srv);
-        return -1;
-    }
+    g_mutex_init(&srv->lock);
 
     virNetlinkEventServerLock(srv);
 
@@ -1070,7 +1067,7 @@ virNetlinkEventServiceStart(unsigned int protocol, unsigned int groups)
  error_locked:
     virNetlinkEventServerUnlock(srv);
     if (ret < 0) {
-        virMutexDestroy(&srv->lock);
+        g_mutex_clear(&srv->lock);
         VIR_FREE(srv);
     }
     return ret;
-- 
2.25.2






[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