summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-09-09 13:43:25 +0000
committerAlan Conway <aconway@apache.org>2010-09-09 13:43:25 +0000
commitcc92e121b9278a0593fec9091b097e4f32d64d6c (patch)
treea130485fa3e39df0d5e3f68b17c680426689cb0a /cpp/src
parentb0782bea575433c9620edd305f888f72a303f674 (diff)
downloadqpid-python-cc92e121b9278a0593fec9091b097e4f32d64d6c.tar.gz
Break deadlock caused when ClusterTimer::drop is called concurrently with Timer::add.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@995426 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/cluster/Cluster.cpp1
-rw-r--r--cpp/src/qpid/sys/Timer.cpp13
2 files changed, 8 insertions, 6 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp
index df0e612af7..5da1579cb7 100644
--- a/cpp/src/qpid/cluster/Cluster.cpp
+++ b/cpp/src/qpid/cluster/Cluster.cpp
@@ -1126,7 +1126,6 @@ void Cluster::timerDrop(const MemberId& , const std::string& name, Lock&) {
}
bool Cluster::isElder() const {
- Monitor::ScopedLock l(lock);
return elder;
}
diff --git a/cpp/src/qpid/sys/Timer.cpp b/cpp/src/qpid/sys/Timer.cpp
index 3b627687de..76e8b3dc0b 100644
--- a/cpp/src/qpid/sys/Timer.cpp
+++ b/cpp/src/qpid/sys/Timer.cpp
@@ -107,16 +107,19 @@ void Timer::run()
{
ScopedLock<Mutex> l(t->callbackLock);
if (t->cancelled) {
- drop(t);
+ {
+ Monitor::ScopedUnlock u(monitor);
+ drop(t);
+ }
if (delay > lateCancel) {
- QPID_LOG(debug, t->name << " cancelled timer woken up " << delay / TIME_MSEC
- << "ms late");
+ QPID_LOG(debug, t->name << " cancelled timer woken up " <<
+ delay / TIME_MSEC << "ms late");
}
continue;
} else if(Duration(t->nextFireTime, start) >= 0) {
{
- Monitor::ScopedUnlock u(monitor);
- fire(t);
+ Monitor::ScopedUnlock u(monitor);
+ fire(t);
}
// Warn if callback overran next timer's start.
AbsTime end(AbsTime::now());