BIND 10 trac2198_2, updated. 1e8d91020b4f79e53513a78ac11098d4523491e3 [2198] Move get methods into unnamed namespace
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Oct 19 00:15:35 UTC 2012
The branch, trac2198_2 has been updated
via 1e8d91020b4f79e53513a78ac11098d4523491e3 (commit)
from 520286379b515c4b40b1b5e90260c52701124d4a (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 1e8d91020b4f79e53513a78ac11098d4523491e3
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Oct 19 05:44:58 2012 +0530
[2198] Move get methods into unnamed namespace
-----------------------------------------------------------------------
Summary of changes:
src/lib/util/interprocess_sync_file.cc | 49 +++++++++++++++++++-------------
src/lib/util/interprocess_sync_file.h | 5 ----
2 files changed, 29 insertions(+), 25 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/util/interprocess_sync_file.cc b/src/lib/util/interprocess_sync_file.cc
index 509a19c..253720a 100644
--- a/src/lib/util/interprocess_sync_file.cc
+++ b/src/lib/util/interprocess_sync_file.cc
@@ -16,6 +16,8 @@
#include <boost/weak_ptr.hpp>
+#include <map>
+
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -28,6 +30,33 @@ using namespace isc::util::thread;
namespace isc {
namespace util {
+namespace { // unnamed namespace
+
+typedef std::map<std::string, boost::weak_ptr<isc::util::thread::Mutex> >
+ SyncMap;
+
+SyncMap&
+getSyncMap() {
+ // avoid static destruction fiasco when the SyncMap is destroyed
+ // before clients which use it such as logger objects. This leaks,
+ // but isn't a growing leak.
+ static SyncMap* sync_map = new SyncMap;
+
+ return (*sync_map);
+}
+
+Mutex&
+getSyncMapMutex() {
+ // avoid static destruction fiasco when the Mutex is destroyed
+ // before clients which use it such as logger objects. This leaks,
+ // but isn't a growing leak.
+ static Mutex* sync_map_mutex = new Mutex;
+
+ return (*sync_map_mutex);
+}
+
+} // end of unnamed namespace
+
InterprocessSyncFile::InterprocessSyncFile(const std::string& task_name) :
InterprocessSync(task_name),
fd_(-1)
@@ -74,26 +103,6 @@ InterprocessSyncFile::~InterprocessSyncFile() {
// destruction when basic block is exited.
}
-InterprocessSyncFile::SyncMap&
-InterprocessSyncFile::getSyncMap() {
- // avoid static destruction fiasco when the SyncMap is destroyed
- // before clients which use it such as logger objects. This leaks,
- // but isn't a growing leak.
- static SyncMap* sync_map = new SyncMap;
-
- return (*sync_map);
-}
-
-Mutex&
-InterprocessSyncFile::getSyncMapMutex() {
- // avoid static destruction fiasco when the Mutex is destroyed
- // before clients which use it such as logger objects. This leaks,
- // but isn't a growing leak.
- static Mutex* sync_map_mutex = new Mutex;
-
- return (*sync_map_mutex);
-}
-
bool
InterprocessSyncFile::do_lock(int cmd, short l_type) {
// Open lock file only when necessary (i.e., here). This is so that
diff --git a/src/lib/util/interprocess_sync_file.h b/src/lib/util/interprocess_sync_file.h
index 6f7da01..f2a3bcc 100644
--- a/src/lib/util/interprocess_sync_file.h
+++ b/src/lib/util/interprocess_sync_file.h
@@ -21,7 +21,6 @@
#include <boost/shared_ptr.hpp>
-#include <map>
#include <string>
namespace isc {
@@ -86,11 +85,7 @@ protected:
private:
typedef boost::shared_ptr<isc::util::thread::Mutex> MutexPtr;
typedef boost::shared_ptr<isc::util::thread::Mutex::Locker> LockerPtr;
- typedef std::map<std::string, boost::weak_ptr<isc::util::thread::Mutex> >
- SyncMap;
- SyncMap& getSyncMap();
- isc::util::thread::Mutex& getSyncMapMutex();
bool do_lock(int cmd, short l_type);
int fd_; ///< The descriptor for the open file
More information about the bind10-changes
mailing list