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