summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/BlockingQueue.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/sys/BlockingQueue.h')
-rw-r--r--cpp/src/qpid/sys/BlockingQueue.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/cpp/src/qpid/sys/BlockingQueue.h b/cpp/src/qpid/sys/BlockingQueue.h
index c6c6291b97..210cb4ad82 100644
--- a/cpp/src/qpid/sys/BlockingQueue.h
+++ b/cpp/src/qpid/sys/BlockingQueue.h
@@ -22,7 +22,7 @@
*
*/
-#include "Waitable.h"
+#include "qpid/sys/Waitable.h"
#include <queue>
@@ -66,14 +66,17 @@ public:
return true;
}
- T pop() {
+ T pop(Duration timeout=TIME_INFINITE) {
T result;
- bool ok = pop(result);
- assert(ok); (void) ok; // Infinite wait.
+ bool ok = pop(result, timeout);
+ if (!ok)
+ throw Exception("Timed out waiting on a blocking queue");
return result;
}
- /** Push a value onto the queue */
+ /** Push a value onto the queue.
+ * Note it is not an error to push onto a closed queue.
+ */
void push(const T& t) {
Mutex::ScopedLock l(waitable);
queue.push(t);