summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Instance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/Instance.cpp')
-rw-r--r--cpp/src/Ice/Instance.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index dbb7524c0f0..959bf3e1a06 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -232,6 +232,24 @@ IceInternal::Instance::serverThreadPool()
return _serverThreadPool;
}
+IceUtil::TimerPtr
+IceInternal::Instance::timer()
+{
+ IceUtil::RecMutex::Lock sync(*this);
+
+ if(_state == StateDestroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
+ if(!_timer) // Lazy initialization.
+ {
+ _timer = new IceUtil::Timer;
+ }
+
+ return _timer;
+}
+
bool
IceInternal::Instance::threadPerConnection() const
{
@@ -710,6 +728,7 @@ IceInternal::Instance::~Instance()
assert(!_objectAdapterFactory);
assert(!_clientThreadPool);
assert(!_serverThreadPool);
+ assert(!_timer);
assert(!_routerManager);
assert(!_locatorManager);
assert(!_endpointFactoryManager);
@@ -892,6 +911,12 @@ IceInternal::Instance::destroy()
std::swap(_clientThreadPool, clientThreadPool);
}
+ if(_timer)
+ {
+ _timer->destroy();
+ _timer = 0;
+ }
+
if(_servantFactoryManager)
{
_servantFactoryManager->destroy();