summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/CommunicatorI.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-10-23 06:22:17 +0000
committerMichi Henning <michi@zeroc.com>2003-10-23 06:22:17 +0000
commit0fdb3361e7525f4f49556d1233d9b84c566ec6fb (patch)
treef128daba58f02bfc2c3a4d975c001eeab2562b43 /cpp/src/Ice/CommunicatorI.cpp
parentfixes (diff)
downloadice-0fdb3361e7525f4f49556d1233d9b84c566ec6fb.tar.bz2
ice-0fdb3361e7525f4f49556d1233d9b84c566ec6fb.tar.xz
ice-0fdb3361e7525f4f49556d1233d9b84c566ec6fb.zip
- Renamed ObjectBase to GCShared.
- Fixed the problem of the gc test sometimes running for over three minutes. - Fixed race condition in printGCStats if a signal caused communicator shutdown.
Diffstat (limited to 'cpp/src/Ice/CommunicatorI.cpp')
-rw-r--r--cpp/src/Ice/CommunicatorI.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp
index 52f4bd86d6c..d7aabbebd47 100644
--- a/cpp/src/Ice/CommunicatorI.cpp
+++ b/cpp/src/Ice/CommunicatorI.cpp
@@ -30,6 +30,7 @@ using namespace Ice;
using namespace IceInternal;
int Ice::CommunicatorI::_communicatorCount = 0;
+IceUtil::StaticMutex Ice::CommunicatorI::_gcMutex = ICE_STATIC_MUTEX_INITIALIZER;
Ice::CommunicatorI::GarbageCollectorStats Ice::CommunicatorI::_gcStats;
int Ice::CommunicatorI::_gcTraceLevel;
string Ice::CommunicatorI::_gcTraceCat;
@@ -69,6 +70,8 @@ Ice::CommunicatorI::destroy()
if(last)
{
+ IceUtil::StaticMutex::Lock l(_gcMutex);
+
if(_gcTraceLevel)
{
Trace out(_gcLogger, _gcTraceCat);
@@ -79,6 +82,7 @@ Ice::CommunicatorI::destroy()
out << "s";
}
}
+ _gcTraceLevel = 0;
_gcLogger = 0;
}
@@ -336,9 +340,12 @@ Ice::CommunicatorI::CommunicatorI(int& argc, char* argv[], const PropertiesPtr&
IceUtil::RecMutex::Lock sync(*this);
if(++_communicatorCount == 1)
{
- _gcTraceLevel = _instance->traceLevels()->gc;
- _gcTraceCat = _instance->traceLevels()->gcCat;
- _gcLogger = _instance->logger();
+ {
+ IceUtil::StaticMutex::Lock l(_gcMutex);
+ _gcTraceLevel = _instance->traceLevels()->gc;
+ _gcTraceCat = _instance->traceLevels()->gcCat;
+ _gcLogger = _instance->logger();
+ }
theCollector = new IceUtil::GC(properties->getPropertyAsInt("Ice.GC.Interval"), printGCStats);
theCollector->start();
}
@@ -376,6 +383,8 @@ Ice::CommunicatorI::finishSetup(int& argc, char* argv[])
void
Ice::CommunicatorI::printGCStats(const ::IceUtil::GCStats& stats)
{
+ IceUtil::StaticMutex::Lock l(_gcMutex);
+
if(_gcTraceLevel)
{
if(_gcTraceLevel > 1)