clingo
|
A (base) class for distributing items between n different threads. More...
#include <multi_queue.h>
Public Types | |
typedef Detail::NodeBase * | ThreadId |
Public Member Functions | |
MultiQueue (uint32 m, const Deleter &d=Deleter()) | |
creates a new object for at most m threads More... | |
uint32 | maxThreads () const |
void | reserve (uint32 c) |
~MultiQueue () | |
destroys the object and all unconsumed items More... | |
ThreadId | addThread () |
adds a new thread to the object More... | |
bool | hasItems (ThreadId &cId) const |
bool | tryConsume (ThreadId &cId, T &out) |
tries to consume an item More... | |
void | pop (ThreadId &cId) |
pops an item from the queue associated with the given thread More... | |
Protected Types | |
typedef Detail::Node< T > | Node |
typedef Detail::NodeBase | NodeBase |
Protected Member Functions | |
void | unsafePublish (const T &in, const ThreadId &) |
publishes a new item More... | |
void | publish (const T &in, const ThreadId &) |
concurrency-safe version of unsafePublish More... | |
void | publishRelaxed (NodeBase *n) |
Non-atomically adds n to the global queue. More... | |
uint32 | maxQ () const |
Node * | allocate (uint32 maxR, const T &in) |
A (base) class for distributing items between n different threads.
Logically, the class maintains n queues, one for each involved thread. Threads must register themselves by calling addThread(). The returned handle has then to be used for publishing and consuming items.
|
protected |
|
protected |
typedef Detail::NodeBase* Clasp::mt::MultiQueue< T, Deleter >::ThreadId |
|
inlineexplicit |
creates a new object for at most m threads
|
inline |
destroys the object and all unconsumed items
|
inline |
adds a new thread to the object
|
inlineprotected |
|
inline |
|
inlineprotected |
|
inline |
|
inline |
pops an item from the queue associated with the given thread
|
inlineprotected |
concurrency-safe version of unsafePublish
|
inlineprotected |
Non-atomically adds n to the global queue.
|
inline |
|
inline |
tries to consume an item
|
inlineprotected |
publishes a new item