From 466c5dc531c7ef4f535a753cd98c611b6e8a0f14 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 10 Dec 2010 09:17:18 +0000 Subject: QPID-2966: Add QMF method to dynamically set the log level. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1044248 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/BlockingQueue.h | 6 +++++- cpp/src/qpid/sys/Waitable.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/sys') diff --git a/cpp/src/qpid/sys/BlockingQueue.h b/cpp/src/qpid/sys/BlockingQueue.h index 210cb4ad82..ca6b529930 100644 --- a/cpp/src/qpid/sys/BlockingQueue.h +++ b/cpp/src/qpid/sys/BlockingQueue.h @@ -53,9 +53,13 @@ public: Waitable::ScopedWait w(waitable); if (timeout == TIME_INFINITE) { while (queue.empty()) waitable.wait(); - } else { + } else if (timeout) { AbsTime deadline(now(),timeout); while (queue.empty() && deadline > now()) waitable.wait(deadline); + } else { + //ensure zero timeout pop does not miss the fact that + //queue is closed + waitable.checkException(); } } if (queue.empty()) return false; diff --git a/cpp/src/qpid/sys/Waitable.h b/cpp/src/qpid/sys/Waitable.h index 7701b6f97d..8f6bd17049 100644 --- a/cpp/src/qpid/sys/Waitable.h +++ b/cpp/src/qpid/sys/Waitable.h @@ -79,6 +79,9 @@ class Waitable : public Monitor { /** True if the waitable has an exception */ bool hasException() const { return exception; } + /** Throws if the waitable has an exception */ + void checkException() const { exception.raise(); } + /** Clear the exception if any */ void resetException() { exception.reset(); } -- cgit v1.2.1