summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2013-04-25 12:28:23 +0000
committerGordon Sim <gsim@apache.org>2013-04-25 12:28:23 +0000
commita9a2188dd716e0488792062e4f70d4488d52f839 (patch)
tree952a699b7faf7269f674ccc22414ccb9e4eaa989 /cpp/src
parent6323c9149fd223ba015cd667b78b7fe55807fcaf (diff)
downloadqpid-python-a9a2188dd716e0488792062e4f70d4488d52f839.tar.gz
QPID-4764: tweaks to locking in receiver and session to avoid deadlock
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1475723 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp11
-rw-r--r--cpp/src/qpid/client/amqp0_10/SessionImpl.cpp2
2 files changed, 8 insertions, 5 deletions
diff --git a/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp b/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp
index 11f9475cad..7e8de21247 100644
--- a/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp
+++ b/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp
@@ -123,7 +123,6 @@ void ReceiverImpl::init(qpid::client::AsyncSession s, AddressResolution& resolve
}
const std::string& ReceiverImpl::getName() const {
- sys::Mutex::ScopedLock l(lock);
return destination;
}
@@ -200,9 +199,15 @@ void ReceiverImpl::closeImpl()
if (state != CANCELLED) {
state = CANCELLED;
sync(session).messageStop(destination);
- parent->releasePending(destination);
+ {
+ sys::Mutex::ScopedUnlock l(lock);
+ parent->releasePending(destination);
+ }
source->cancel(session, destination);
- parent->receiverCancelled(destination);
+ {
+ sys::Mutex::ScopedUnlock l(lock);
+ parent->receiverCancelled(destination);
+ }
}
}
diff --git a/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp b/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp
index be5eab1f2b..e4c2c6afb8 100644
--- a/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp
+++ b/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp
@@ -471,13 +471,11 @@ void SessionImpl::rollbackImpl()
void SessionImpl::acknowledgeImpl()
{
- ScopedLock l(lock);
if (!transactional) incoming.accept();
}
void SessionImpl::acknowledgeImpl(qpid::messaging::Message& m, bool cumulative)
{
- ScopedLock l(lock);
if (!transactional) incoming.accept(MessageImplAccess::get(m).getInternalId(), cumulative);
}