summaryrefslogtreecommitdiff
path: root/cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp')
-rw-r--r--cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp b/cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp
index 9bd8f601760..357cfa69d56 100644
--- a/cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp
+++ b/cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp
@@ -11,10 +11,11 @@
#include <CurrentDatabase.h>
using namespace std;
+using namespace IceUtil;
//
-// This implementation is very simple but not restartable, i.e.
-// you can only create and destroy one CurrentDatabase per process run.
+// This implementation is very simple but not restartable, i.e. you
+// can only create and destroy one CurrentDatabase per process run.
//
#ifdef _MSC_VER
@@ -32,11 +33,10 @@ __thread Database* db = 0;
}
-
-CurrentDatabase::CurrentDatabase(const Ice::CommunicatorPtr& communicator, const string& envName, const string& dbName)
- : _communicator(communicator),
- _envName(envName),
- _dbName(dbName)
+CurrentDatabase::CurrentDatabase(const Ice::CommunicatorPtr& comm, const string& envName, const string& dbName) :
+ _communicator(comm),
+ _envName(envName),
+ _dbName(dbName)
{
}
@@ -56,10 +56,9 @@ CurrentDatabase::get()
{
Freeze::ConnectionPtr connection = Freeze::createConnection(_communicator, _envName);
db = new Database(connection, _dbName);
+
+ Mutex::Lock sync(_dbListMutex);
_dbList.push_back(db);
}
return *db;
}
-
-
-