summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/Serializer.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-11-14 09:34:51 +0000
committerGordon Sim <gsim@apache.org>2007-11-14 09:34:51 +0000
commit5447b80198e5ddac4a10678e1dd5fe76cd435d2b (patch)
treef9e7010e0b375835cbcc0a1096e52c348e041f2f /cpp/src/qpid/sys/Serializer.cpp
parent2195842076e65d340d58c2e7f4652135946a2dfc (diff)
downloadqpid-python-5447b80198e5ddac4a10678e1dd5fe76cd435d2b.tar.gz
Fixed locking (lock was not being released for invocation on callback due to being locked twice but unlocked only once)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@594812 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/Serializer.cpp')
-rw-r--r--cpp/src/qpid/sys/Serializer.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/cpp/src/qpid/sys/Serializer.cpp b/cpp/src/qpid/sys/Serializer.cpp
index f02e51ddb4..a82982a0c8 100644
--- a/cpp/src/qpid/sys/Serializer.cpp
+++ b/cpp/src/qpid/sys/Serializer.cpp
@@ -51,11 +51,20 @@ void SerializerBase::notifyWorker() {
lock.notify();
}
-void SerializerBase::run() {
+bool SerializerBase::running() {
+ Mutex::ScopedLock l(lock);
+ return state != SHUTDOWN;
+}
+
+void SerializerBase::wait() {
Mutex::ScopedLock l(lock);
- while (state != SHUTDOWN) {
+ lock.wait();
+}
+
+void SerializerBase::run() {
+ while (running()) {
dispatch();
- lock.wait();
+ wait();
}
}