summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ACM.cpp19
-rw-r--r--cpp/src/Ice/ACM.h2
2 files changed, 20 insertions, 1 deletions
diff --git a/cpp/src/Ice/ACM.cpp b/cpp/src/Ice/ACM.cpp
index 9392df6aacc..bb620d07430 100644
--- a/cpp/src/Ice/ACM.cpp
+++ b/cpp/src/Ice/ACM.cpp
@@ -94,8 +94,26 @@ IceInternal::FactoryACMMonitor::destroy()
return;
}
+ //
+ // Cancel the scheduled timer task and schedule it again now to clear the
+ // connection set from the timer thread.
+ //
+ if(!_connections.empty())
+ {
+ _instance->timer()->cancel(ICE_SHARED_FROM_THIS);
+ _instance->timer()->schedule(ICE_SHARED_FROM_THIS, IceUtil::Time());
+ }
+
_instance = 0;
_changes.clear();
+
+ //
+ // Wait for the connection set to be cleared by the timer thread.
+ //
+ while(!_connections.empty())
+ {
+ wait();
+ }
}
void
@@ -187,6 +205,7 @@ IceInternal::FactoryACMMonitor::runTimerTask()
if(!_instance)
{
_connections.clear();
+ notify();
return;
}
diff --git a/cpp/src/Ice/ACM.h b/cpp/src/Ice/ACM.h
index 169efd984db..77ca93a121a 100644
--- a/cpp/src/Ice/ACM.h
+++ b/cpp/src/Ice/ACM.h
@@ -50,7 +50,7 @@ public:
virtual Ice::ACM getACM() = 0;
};
-class FactoryACMMonitor : public ACMMonitor, public IceUtil::Mutex
+class FactoryACMMonitor : public ACMMonitor, public IceUtil::Monitor<IceUtil::Mutex>
#ifdef ICE_CPP11_MAPPING
, public std::enable_shared_from_this<FactoryACMMonitor>
#endif