diff options
author | Matthew Newhook <matthew@zeroc.com> | 2007-06-12 10:10:27 +0800 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2007-06-12 10:10:27 +0800 |
commit | dad94809b45711bfcc23f33f2ac7ad89c6460c8c (patch) | |
tree | 26747d77dd0f225418ca45c5c265c552ebfa6ba6 /cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp | |
parent | added .gitignore updates. (diff) | |
download | ice-dad94809b45711bfcc23f33f2ac7ad89c6460c8c.tar.bz2 ice-dad94809b45711bfcc23f33f2ac7ad89c6460c8c.tar.xz ice-dad94809b45711bfcc23f33f2ac7ad89c6460c8c.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2231
Diffstat (limited to 'cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp')
-rw-r--r-- | cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp | 19 |
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; } - - - |