diff options
author | Gordon Sim <gsim@apache.org> | 2007-12-05 16:19:32 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2007-12-05 16:19:32 +0000 |
commit | 71f61e7240d5f1c220cef88f88fde45878fe2e5f (patch) | |
tree | 17fc257c1291b017de108667f1945cdf89dde892 /cpp/src | |
parent | ca6eff1607964380e140c8b3e5fc0ffaede42f0c (diff) | |
download | qpid-python-71f61e7240d5f1c220cef88f88fde45878fe2e5f.tar.gz |
Avoid holding lock while making the flush calls (can cause deadlocking)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@601391 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/PersistableMessage.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cpp/src/qpid/broker/PersistableMessage.cpp b/cpp/src/qpid/broker/PersistableMessage.cpp index a00a623988..f3ca574503 100644 --- a/cpp/src/qpid/broker/PersistableMessage.cpp +++ b/cpp/src/qpid/broker/PersistableMessage.cpp @@ -28,12 +28,18 @@ using namespace qpid::broker; void PersistableMessage::flush() { - sys::ScopedLock<sys::Mutex> l(storeLock); - if (store) { - for (syncList::iterator i = synclist.begin(); i != synclist.end(); ++i) { - store->flush(*(*i)); - } + syncList copy; + { + sys::ScopedLock<sys::Mutex> l(storeLock); + if (store) { + copy = synclist; + } else { + return;//early exit as nothing to do + } } + for (syncList::iterator i = copy.begin(); i != copy.end(); ++i) { + store->flush(*(*i)); + } } |