summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/QueueBindings.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2012-01-13 16:20:11 +0000
committerTed Ross <tross@apache.org>2012-01-13 16:20:11 +0000
commit39f068763c649f63f2c42ab19e76d4f76d612ff5 (patch)
treeb42fa4f31756c6968c46ec44f374bfba58f1e9b1 /cpp/src/qpid/broker/QueueBindings.cpp
parentc44b822a882a7339c53435f5b58b6d0a175e7a33 (diff)
downloadqpid-python-39f068763c649f63f2c42ab19e76d4f76d612ff5.tar.gz
QPID-3755 - Concurrent queue bind on the same queue results in crash
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1231158 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/QueueBindings.cpp')
-rw-r--r--cpp/src/qpid/broker/QueueBindings.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/cpp/src/qpid/broker/QueueBindings.cpp b/cpp/src/qpid/broker/QueueBindings.cpp
index 60d315acfe..c6b3ddf9a9 100644
--- a/cpp/src/qpid/broker/QueueBindings.cpp
+++ b/cpp/src/qpid/broker/QueueBindings.cpp
@@ -30,16 +30,22 @@ using namespace qpid::broker;
void QueueBindings::add(const string& exchange, const string& key, const FieldTable& args)
{
+ sys::Mutex::ScopedLock l(lock);
bindings.push_back(QueueBinding(exchange, key, args));
}
void QueueBindings::unbind(ExchangeRegistry& exchanges, Queue::shared_ptr queue)
{
- for (Bindings::iterator i = bindings.begin(); i != bindings.end(); i++) {
+ Bindings local;
+ {
+ sys::Mutex::ScopedLock l(lock);
+ local = bindings;
+ }
+
+ for (Bindings::iterator i = local.begin(); i != local.end(); i++)
try {
exchanges.get(i->exchange)->unbind(queue, i->key, &(i->args));
} catch (const NotFoundException&) {}
- }
}
QueueBinding::QueueBinding(const string& _exchange, const string& _key, const FieldTable& _args)