diff options
author | Gordon Sim <gsim@apache.org> | 2011-04-12 15:04:00 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2011-04-12 15:04:00 +0000 |
commit | 2a52a4bc7e34dee86612f5a05fea06c2452121d5 (patch) | |
tree | f3dfb43ee7869e55f855c6138f1bba0d852d7ff3 /cpp/src | |
parent | 7a91aabcfa58ee847b0d067f65ef5fab62c467ee (diff) | |
download | qpid-python-2a52a4bc7e34dee86612f5a05fea06c2452121d5.tar.gz |
QPID-3201: locking in NullMessageStore to protect set of prepared xids
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1091443 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/NullMessageStore.cpp | 4 | ||||
-rw-r--r-- | cpp/src/qpid/broker/NullMessageStore.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/NullMessageStore.cpp b/cpp/src/qpid/broker/NullMessageStore.cpp index dc8615d58b..43f600eaf1 100644 --- a/cpp/src/qpid/broker/NullMessageStore.cpp +++ b/cpp/src/qpid/broker/NullMessageStore.cpp @@ -126,21 +126,25 @@ std::auto_ptr<TPCTransactionContext> NullMessageStore::begin(const std::string& void NullMessageStore::prepare(TPCTransactionContext& ctxt) { + qpid::sys::ScopedLock<qpid::sys::Mutex> l(lock); prepared.insert(DummyCtxt::getXid(ctxt)); } void NullMessageStore::commit(TransactionContext& ctxt) { + qpid::sys::ScopedLock<qpid::sys::Mutex> l(lock); prepared.erase(DummyCtxt::getXid(ctxt)); } void NullMessageStore::abort(TransactionContext& ctxt) { + qpid::sys::ScopedLock<qpid::sys::Mutex> l(lock); prepared.erase(DummyCtxt::getXid(ctxt)); } void NullMessageStore::collectPreparedXids(std::set<std::string>& out) { + qpid::sys::ScopedLock<qpid::sys::Mutex> l(lock); out.insert(prepared.begin(), prepared.end()); } diff --git a/cpp/src/qpid/broker/NullMessageStore.h b/cpp/src/qpid/broker/NullMessageStore.h index e148ec4d51..5f51d53886 100644 --- a/cpp/src/qpid/broker/NullMessageStore.h +++ b/cpp/src/qpid/broker/NullMessageStore.h @@ -25,6 +25,7 @@ #include "qpid/broker/BrokerImportExport.h" #include "qpid/broker/MessageStore.h" #include "qpid/broker/Queue.h" +#include "qpid/sys/Mutex.h" #include <boost/intrusive_ptr.hpp> @@ -38,6 +39,7 @@ class NullMessageStore : public MessageStore { std::set<std::string> prepared; uint64_t nextPersistenceId; + qpid::sys::Mutex lock; public: QPID_BROKER_EXTERN NullMessageStore(); |