Template Class MPSCQueue
Defined in File MPSCQueue.h
Nested Relationships
Nested Types
Class Documentation
-
template<class T, std::size_t B = 1024>
class MPSCQueue an unbounded queue from many producers to one consumer, a lane each
Public Functions
-
MPSCQueue(void) = default
-
~MPSCQueue()
destroys the items left, the blocks and the lanes
-
bool tryPop(T &x)
dequeues an item into x, false if none was found in a turn of the lanes; only the consumer calls it
-
std::size_t popInto(T *out, std::size_t n)
dequeues up to n items into out, those of a lane before the next one, and returns how many; only the consumer calls it
-
inline void waitPop(T &x)
dequeues an item into x, sleeping until one comes [see EventCount.h], the producers calling notify() after their pushes; only the consumer calls it
-
inline std::size_t waitPopInto(T *out, std::size_t n)
as popInto(), sleeping until at least one item comes; n >= 1
-
bool empty(void)
true if no item was found in a turn of the lanes; only the consumer calls it
-
class Producer
the handle of a producer, its lane: one thread at a time pushes
Public Functions
-
Producer(void) = default
-
template<class ...Args>
void emplace(Args&&... args) enqueues the item built from args
- Pre:
the handle comes from producer()
-
inline void notify(void)
wakes the consumer if it sleeps in waitPop() or waitPopInto(), after pushes: a fence and the read of a line when it does not
- Pre:
the handle comes from producer()
-
Producer(void) = default
-
MPSCQueue(void) = default