summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/sys')
-rw-r--r--cpp/src/qpid/sys/PollableQueue.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/cpp/src/qpid/sys/PollableQueue.h b/cpp/src/qpid/sys/PollableQueue.h
index 7f11cc35a9..56c1d9e80a 100644
--- a/cpp/src/qpid/sys/PollableQueue.h
+++ b/cpp/src/qpid/sys/PollableQueue.h
@@ -119,17 +119,15 @@ template <class T> void PollableQueue<T>::dispatch(sys::DispatchHandle& h) {
ScopedLock l(lock);
assert(dispatcher.id() == 0);
dispatcher = Thread::current();
- while (!stopped && !queue.empty()) {
- assert(batch.empty());
- batch.swap(queue);
- {
- ScopedUnlock u(lock); // Allow concurrent push to queue.
- callback(batch);
- }
- if (!batch.empty()) {
- queue.insert(queue.begin(), batch.begin(), batch.end()); // put back unprocessed items.
- batch.clear();
- }
+ assert(batch.empty());
+ batch.swap(queue);
+ {
+ ScopedUnlock u(lock); // Allow concurrent push to queue.
+ callback(batch);
+ }
+ if (!batch.empty()) {
+ queue.insert(queue.begin(), batch.begin(), batch.end()); // put back unprocessed items.
+ batch.clear();
}
dispatcher = Thread();
if (queue.empty()) condition.clear();