9 #ifndef CPPCOMMON_THREADS_WAIT_QUEUE_H
10 #define CPPCOMMON_THREADS_WAIT_QUEUE_H
45 explicit operator bool() const noexcept {
return !
closed() && !
empty(); }
97 const size_t _capacity;
101 std::queue<T> _queue;
Condition variable synchronization primitive.
Critical section synchronization primitive.
Multiple producers / multiple consumers wait queue.
bool Enqueue(const T &item)
Enqueue an item into the wait queue.
bool empty() const
Is wait queue empty?
bool Dequeue(T &item)
Dequeue an item from the wait queue.
void Close()
Close the wait queue.
WaitQueue(size_t capacity=0)
Default class constructor.
size_t capacity() const
Get wait queue capacity.
WaitQueue(const WaitQueue &)=delete
WaitQueue & operator=(WaitQueue &&)=default
WaitQueue(WaitQueue &&)=default
bool closed() const
Is wait queue closed?
WaitQueue & operator=(const WaitQueue &)=delete
size_t size() const
Get wait queue size.
Condition variable synchronization primitive definition.
C++ Common project definitions.
Multiple producers / multiple consumers wait queue inline implementation.