diff options
| author | Alan Conway <aconway@apache.org> | 2009-07-09 20:38:23 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2009-07-09 20:38:23 +0000 |
| commit | 0c5ace5d2114d638bdef5f4c2e29521c43f140a4 (patch) | |
| tree | 575392461bf2bc98f8ea4b8f2c9241aad134cf55 /cpp/src/qpid/sys/PollableQueue.h | |
| parent | c25ed489bd7a5ae7fce248dcc105b9ad7f6a1e65 (diff) | |
| download | qpid-python-0c5ace5d2114d638bdef5f4c2e29521c43f140a4.tar.gz | |
Simplified PollableCondition
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@792676 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/PollableQueue.h')
| -rw-r--r-- | cpp/src/qpid/sys/PollableQueue.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/cpp/src/qpid/sys/PollableQueue.h b/cpp/src/qpid/sys/PollableQueue.h index 1d390a6eb0..0786b21610 100644 --- a/cpp/src/qpid/sys/PollableQueue.h +++ b/cpp/src/qpid/sys/PollableQueue.h @@ -119,7 +119,6 @@ template <class T> void PollableQueue<T>::start() { if (!stopped) return; stopped = false; if (!queue.empty()) condition.set(); - condition.rearm(); } template <class T> PollableQueue<T>::~PollableQueue() { @@ -139,7 +138,6 @@ template <class T> void PollableQueue<T>::dispatch(PollableCondition& cond) { dispatcher = Thread(); if (queue.empty()) cond.clear(); if (stopped) lock.notifyAll(); - else cond.rearm(); } template <class T> void PollableQueue<T>::process() { @@ -166,11 +164,11 @@ template <class T> void PollableQueue<T>::shutdown() { template <class T> void PollableQueue<T>::stop() { ScopedLock l(lock); if (stopped) return; - condition.disarm(); + condition.clear(); stopped = true; // Avoid deadlock if stop is called from the dispatch thread - while (dispatcher.id() && dispatcher.id() != Thread::current().id()) - lock.wait(); + if (dispatcher.id() != Thread::current().id()) + while (dispatcher.id()) lock.wait(); } }} // namespace qpid::sys |
