File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616
1717#pragma once
1818
19+ #include < input/PrintTools.h>
1920#include < condition_variable>
2021#include < functional>
2122#include < list>
@@ -126,11 +127,21 @@ class BlockingQueue {
126127 * Primary used for debugging.
127128 * Does not block.
128129 */
129- size_t size () {
130+ size_t size () const {
130131 std::scoped_lock lock (mLock );
131132 return mQueue .size ();
132133 }
133134
135+ bool empty () const {
136+ std::scoped_lock lock (mLock );
137+ return mQueue .empty ();
138+ }
139+
140+ std::string dump (std::string (*toString)(const T&) = constToString) const {
141+ std::scoped_lock lock (mLock );
142+ return dumpContainer (mQueue , toString);
143+ }
144+
134145private:
135146 const std::optional<size_t > mCapacity ;
136147 /* *
@@ -140,7 +151,7 @@ class BlockingQueue {
140151 /* *
141152 * Lock for accessing and waiting on elements.
142153 */
143- std::mutex mLock ;
154+ mutable std::mutex mLock ;
144155 std::list<T> mQueue GUARDED_BY (mLock );
145156};
146157
You can’t perform that action at this time.
0 commit comments