From 4820d57fa8c4d4dcf7e577b1fd85798d3228c0ed Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 15 Sep 2004 15:28:58 +0000 Subject: [PATCH] Expose the size() method for locked and blocking thread queues. --- simgear/threads/SGQueue.hxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/simgear/threads/SGQueue.hxx b/simgear/threads/SGQueue.hxx index 83a1cfeb..532106bf 100644 --- a/simgear/threads/SGQueue.hxx +++ b/simgear/threads/SGQueue.hxx @@ -61,6 +61,13 @@ public: */ virtual T pop() = 0; + /** + * Query the size of the queue + * + * @return size_t size of queue. + */ + virtual size_t size() = 0; + protected: /** * @@ -136,6 +143,17 @@ public: this->fifo.pop(); return item; } + + /** + * Query the size of the queue + * + * @return size_t size of queue. + */ + virtual size_t size() { + SGGuard g(mutex); + return this->fifo.size(); + } + private: /** @@ -222,6 +240,16 @@ public: return item; } + /** + * Query the size of the queue + * + * @return size_t size of queue. + */ + virtual size_t size() { + SGGuard g(mutex); + return this->fifo.size(); + } + private: /** -- 2.39.5