diff options
Diffstat (limited to 'cpp')
| -rw-r--r-- | cpp/src/qpid/client/LocalQueue.cpp | 7 | ||||
| -rw-r--r-- | cpp/src/qpid/client/LocalQueue.h | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/BlockingQueue.h | 7 |
3 files changed, 14 insertions, 1 deletions
diff --git a/cpp/src/qpid/client/LocalQueue.cpp b/cpp/src/qpid/client/LocalQueue.cpp index 7fbe4a053e..f44a04837b 100644 --- a/cpp/src/qpid/client/LocalQueue.cpp +++ b/cpp/src/qpid/client/LocalQueue.cpp @@ -47,4 +47,11 @@ Message LocalQueue::pop() { void LocalQueue::setAckPolicy(AckPolicy a) { autoAck=a; } +bool LocalQueue::empty() +{ + if (!queue) + throw ClosedException(); + return queue->isEmpty(); +} + }} // namespace qpid::client diff --git a/cpp/src/qpid/client/LocalQueue.h b/cpp/src/qpid/client/LocalQueue.h index 1c910bd3ee..0c958d8f24 100644 --- a/cpp/src/qpid/client/LocalQueue.h +++ b/cpp/src/qpid/client/LocalQueue.h @@ -42,6 +42,7 @@ class LocalQueue *@exception ClosedException if subscription has been closed. */ Message pop(); + bool empty(); void setAckPolicy(AckPolicy); diff --git a/cpp/src/qpid/sys/BlockingQueue.h b/cpp/src/qpid/sys/BlockingQueue.h index 44c95b225d..bcd8c84276 100644 --- a/cpp/src/qpid/sys/BlockingQueue.h +++ b/cpp/src/qpid/sys/BlockingQueue.h @@ -99,7 +99,12 @@ public: Waitable::ScopedLock l(lock); return closed; } - + + bool isEmpty() const { + Waitable::ScopedLock l(lock); + return queue.empty(); + } + private: void queueNotify(size_t ignore) { |
