BIND 10 trac2198, updated. 70995385175f42009f9a54df4613c71b732134b2 [2198] Check return value of pthread_mutex_init() and destroy() calls too

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Sep 18 05:41:31 UTC 2012


The branch, trac2198 has been updated
       via  70995385175f42009f9a54df4613c71b732134b2 (commit)
      from  9557da6ee10d028954c054d719071753ddd0266d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 70995385175f42009f9a54df4613c71b732134b2
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Sep 18 11:10:48 2012 +0530

    [2198] Check return value of pthread_mutex_init() and destroy() calls too

-----------------------------------------------------------------------

Summary of changes:
 src/lib/util/interprocess_sync_file.cc |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/util/interprocess_sync_file.cc b/src/lib/util/interprocess_sync_file.cc
index 6b33a39..430e05e 100644
--- a/src/lib/util/interprocess_sync_file.cc
+++ b/src/lib/util/interprocess_sync_file.cc
@@ -112,7 +112,14 @@ InterprocessSyncFile::InterprocessSyncFile(const std::string& task_name) :
         // No data was found in the map, so create and insert one.
         data = new SyncMapData;
         data->first = 0;
-        pthread_mutex_init(&data->second, NULL);
+
+        int ret = pthread_mutex_init(&data->second, NULL);
+        if (ret != 0) {
+            isc_throw(isc::InvalidOperation,
+                      "Error initializing InterprocessSyncFile mutex: "
+                      << strerror(ret));
+        }
+
         sync_map[task_name] = data;
     }
 
@@ -147,7 +154,14 @@ InterprocessSyncFile::~InterprocessSyncFile() {
     data->first--;
     if (data->first == 0) {
         sync_map.erase(it);
-        pthread_mutex_destroy(&data->second);
+
+        int ret = pthread_mutex_destroy(&data->second);
+        if (ret != 0) {
+            isc_throw(isc::InvalidOperation,
+                      "Error destroying InterprocessSyncFile mutex: "
+                      << strerror(ret));
+        }
+
         delete data;
     }
 



More information about the bind10-changes mailing list