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

[libvirt] [PATCH v2 2/5] add condition variable and job signals support to _virStoragePoolObj



---
 src/conf/storage_conf.c |   10 ++++++++++
 src/conf/storage_conf.h |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index cc55b80..093b760 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -323,6 +323,7 @@ virStoragePoolObjFree(virStoragePoolObjPtr obj) {
     VIR_FREE(obj->autostartLink);
 
     virMutexDestroy(&obj->lock);
+    ignore_value(virCondDestroy(&obj->cond));
 
     VIR_FREE(obj);
 }
@@ -1391,6 +1392,15 @@ virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
         VIR_FREE(pool);
         return NULL;
     }
+
+    if (virCondInit(&pool->cond) < 0) {
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+                              "%s", _("cannot initialize cond"));
+        virMutexDestroy(&pool->lock);
+        VIR_FREE(pool);
+        return NULL;
+    }
+
     virStoragePoolObjLock(pool);
     pool->active = 0;
     pool->def = def;
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 271441a..60a1a52 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -275,12 +275,14 @@ typedef virStoragePoolObj *virStoragePoolObjPtr;
 
 struct _virStoragePoolObj {
     virMutex lock;
+    virCond cond;
 
     char *configFile;
     char *autostartLink;
     int active;
     int autostart;
     unsigned int asyncjobs;
+    unsigned int jobSignals;
 
     virStoragePoolDefPtr def;
     virStoragePoolDefPtr newDef;
-- 
1.7.1


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