summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-01-04 16:49:29 +0000
committerGordon Sim <gsim@apache.org>2008-01-04 16:49:29 +0000
commit46dc9376317d0308c06412d203a192a4a9ecb468 (patch)
tree84ffa26c8298378ac4481fa8a8a9813aef67c0d3 /qpid/cpp/src
parentcd48dde21a509f07e879ede979d01b92b43c4f98 (diff)
downloadqpid-python-46dc9376317d0308c06412d203a192a4a9ecb468.tar.gz
Provide method to test for empty local queue.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@608915 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/client/LocalQueue.cpp7
-rw-r--r--qpid/cpp/src/qpid/client/LocalQueue.h1
-rw-r--r--qpid/cpp/src/qpid/sys/BlockingQueue.h7
3 files changed, 14 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/client/LocalQueue.cpp b/qpid/cpp/src/qpid/client/LocalQueue.cpp
index 7fbe4a053e..f44a04837b 100644
--- a/qpid/cpp/src/qpid/client/LocalQueue.cpp
+++ b/qpid/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/qpid/cpp/src/qpid/client/LocalQueue.h b/qpid/cpp/src/qpid/client/LocalQueue.h
index 1c910bd3ee..0c958d8f24 100644
--- a/qpid/cpp/src/qpid/client/LocalQueue.h
+++ b/qpid/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/qpid/cpp/src/qpid/sys/BlockingQueue.h b/qpid/cpp/src/qpid/sys/BlockingQueue.h
index 44c95b225d..bcd8c84276 100644
--- a/qpid/cpp/src/qpid/sys/BlockingQueue.h
+++ b/qpid/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) {