From dad94809b45711bfcc23f33f2ac7ad89c6460c8c Mon Sep 17 00:00:00 2001 From: Matthew Newhook Date: Tue, 12 Jun 2007 10:10:27 +0800 Subject: http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2231 --- cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'cpp/demo/Freeze/customEvictor/CurrentDatabase.cpp') 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 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; } - - - -- cgit v1.2.3