diff options
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/broker/Timer.cpp | 12 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Timer.h | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/client/LocalQueue.cpp | 11 | ||||
| -rw-r--r-- | cpp/src/qpid/client/LocalQueue.h | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/BlockingQueue.h | 6 |
5 files changed, 20 insertions, 14 deletions
diff --git a/cpp/src/qpid/broker/Timer.cpp b/cpp/src/qpid/broker/Timer.cpp index 28b1aa56d7..173f350cde 100644 --- a/cpp/src/qpid/broker/Timer.cpp +++ b/cpp/src/qpid/broker/Timer.cpp @@ -85,17 +85,13 @@ void Timer::start() void Timer::stop() { - signalStop(); - runner.join(); -} - -void Timer::signalStop() -{ - Monitor::ScopedLock l(monitor); - if (active) { + { + Monitor::ScopedLock l(monitor); + if (!active) return; active = false; monitor.notifyAll(); } + runner.join(); } bool Later::operator()(const intrusive_ptr<TimerTask>& a, diff --git a/cpp/src/qpid/broker/Timer.h b/cpp/src/qpid/broker/Timer.h index d1f606f326..dcb02a5e0a 100644 --- a/cpp/src/qpid/broker/Timer.h +++ b/cpp/src/qpid/broker/Timer.h @@ -59,7 +59,6 @@ class Timer : private qpid::sys::Runnable { bool active; virtual void run(); - void signalStop(); public: Timer(); diff --git a/cpp/src/qpid/client/LocalQueue.cpp b/cpp/src/qpid/client/LocalQueue.cpp index f44a04837b..951996f005 100644 --- a/cpp/src/qpid/client/LocalQueue.cpp +++ b/cpp/src/qpid/client/LocalQueue.cpp @@ -47,11 +47,18 @@ Message LocalQueue::pop() { void LocalQueue::setAckPolicy(AckPolicy a) { autoAck=a; } -bool LocalQueue::empty() +bool LocalQueue::empty() const { if (!queue) throw ClosedException(); - return queue->isEmpty(); + return queue->empty(); +} + +size_t LocalQueue::size() const +{ + if (!queue) + throw ClosedException(); + return queue->size(); } }} // namespace qpid::client diff --git a/cpp/src/qpid/client/LocalQueue.h b/cpp/src/qpid/client/LocalQueue.h index d7e7e9dbd8..eba28f6599 100644 --- a/cpp/src/qpid/client/LocalQueue.h +++ b/cpp/src/qpid/client/LocalQueue.h @@ -44,8 +44,8 @@ class LocalQueue *@exception ClosedException if subscription has been closed. */ Message pop(); - bool empty(); - + bool empty() const; + size_t size() const; void setAckPolicy(AckPolicy); private: diff --git a/cpp/src/qpid/sys/BlockingQueue.h b/cpp/src/qpid/sys/BlockingQueue.h index 56d41574df..dd709c6bff 100644 --- a/cpp/src/qpid/sys/BlockingQueue.h +++ b/cpp/src/qpid/sys/BlockingQueue.h @@ -103,10 +103,14 @@ public: return closed; } - bool isEmpty() const { + bool empty() const { Waitable::ScopedLock l(lock); return queue.empty(); } + size_t size() const { + Waitable::ScopedLock l(lock); + return queue.size(); + } private: |
