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

[libvirt] [PATCH 30/38] virlog: Acquire virLogAPILock in each setter API



Now that a lock to serialize setters has been introduced, make use of it and
lock every log setting API.
---
 src/util/virlog.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/util/virlog.c b/src/util/virlog.c
index 6aa9c91..240d6e3 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -279,8 +279,10 @@ virLogSetDefaultPriority(virLogPriority priority)
     if (virLogInitialize() < 0)
         return -1;
 
+    virLogAPILock();
     virLogDefaultPriority = priority;
     virLogSerial++;
+    virLogAPIUnlock();
     return 0;
 }
 
@@ -1592,6 +1594,8 @@ virLogSetFilters(const char *filters)
     if (virLogInitialize() < 0)
         return -1;
 
+    virLogAPILock();
+
     if ((count = virLogParseFilters(filters, &list)) < 0)
         goto cleanup;
 
@@ -1600,6 +1604,7 @@ virLogSetFilters(const char *filters)
 
     ret = count;
  cleanup:
+    virLogAPIUnlock();
     if (ret < 0)
         virLogFilterListFree(list, count);
     return ret;
@@ -1627,6 +1632,8 @@ virLogSetOutputs(const char *outputs)
     if (virLogInitialize() < 0)
         return -1;
 
+    virLogAPILock();
+
     if ((count = virLogParseOutputs(outputs, &list)) < 0)
         goto cleanup;
 
@@ -1646,6 +1653,7 @@ virLogSetOutputs(const char *outputs)
 
     ret = count;
  cleanup:
+    virLogAPIUnlock();
     if (ret < 0)
         virLogOutputListFree(list, count);
     return ret;
-- 
2.4.3


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