summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-07-05 00:25:30 +0000
committerMichi Henning <michi@zeroc.com>2004-07-05 00:25:30 +0000
commit882402353161f25970e18f70a4bb7b484105db04 (patch)
treee55c90c913674accc884c2c2b72e45e39862c3b7 /cpp/src
parentSlice checksums for IcePatch (diff)
downloadice-882402353161f25970e18f70a4bb7b484105db04.tar.bz2
ice-882402353161f25970e18f70a4bb7b484105db04.tar.xz
ice-882402353161f25970e18f70a4bb7b484105db04.zip
Changed Instance.cpp to print process ID only once if there are multiple
communicators.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Instance.cpp15
-rw-r--r--cpp/src/Ice/Instance.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index fec1e81d106..0ce1f2ed719 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -81,6 +81,8 @@ public:
static GlobalStateMutexDestroyer destroyer;
+volatile bool Instance::_printProcessIdDone = false;
+
}
void IceInternal::incRef(Instance* p) { p->__incRef(); }
@@ -627,15 +629,20 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
}
//
- // Show process id if requested.
+ // Show process id if requested (but only once).
//
- if(_properties->getPropertyAsInt("Ice.PrintProcessId") > 0)
+ if(!_printProcessIdDone && _properties->getPropertyAsInt("Ice.PrintProcessId") > 0)
{
+ IceUtil::RecMutex::Lock sync(*this); // Double-checked locking
+ if(!_printProcessIdDone)
+ {
#ifdef _WIN32
- cout << _getpid() << endl;
+ cout << _getpid() << endl;
#else
- cout << getpid() << endl;
+ cout << getpid() << endl;
#endif
+ _printProcessIdDone = true;
+ }
}
//
diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h
index f69f8b5dce4..54488b94d74 100644
--- a/cpp/src/Ice/Instance.h
+++ b/cpp/src/Ice/Instance.h
@@ -101,6 +101,7 @@ private:
EndpointFactoryManagerPtr _endpointFactoryManager;
DynamicLibraryListPtr _dynamicLibraryList;
Ice::PluginManagerPtr _pluginManager;
+ volatile static bool _printProcessIdDone;
//
// Global state management