OSDN Git Service

mutexの名前をまとめた
authorcaprice <caprice@users.sourceforge.jp>
Sat, 9 Aug 2014 16:32:07 +0000 (01:32 +0900)
committercaprice <caprice@users.sourceforge.jp>
Sat, 9 Aug 2014 16:32:07 +0000 (01:32 +0900)
include/reference-counter.hpp

index 755d731..5aeef3c 100644 (file)
@@ -14,12 +14,11 @@ public:
     
     reference_counter() : counter(0) {
         mutex = boost::interprocess::
-            named_mutex(boost::interprocess::create_only,
-                        "monazilla.GikoMona.shared-memory.mutex");
+            named_mutex(boost::interprocess::create_only, shared_mutex_name);
     }
     
     ~reference_counter() {
-        named_mutex::remove("monazilla.GikoMona.shared-memory.mutex");
+        named_mutex::remove(shared_mutex_name);
     }
     
     self_type& operator++() { ++counter; return *this; }
@@ -41,6 +40,7 @@ public:
     
 private:
     int counter;
+    static const char *shared_mutex_name = "org.monazilla.GikoMona.shared-memory.mutex";
     boost::interprocess::named_mutex mutex;
 };