ROSE
0.11.96.11
|
First-in-first-out work queue.
This simple work queue is meant to demonstrate the interface used by processWorkList. New work is inserted at the back of the FIFO and consumed from the front. Only one type and three public member functions are necessary. The member functions must be thread safe if any of them are called from worker threads, otherwise they don't need to be thread safe since the processWorkList will syncronize calls to this object.
Definition at line 23 of file WorkList.h.
#include <WorkList.h>
Public Types | |
typedef T | Item |
The type that represents one unit of work. | |
Public Member Functions | |
void | insert (const Item &item) |
Insert one unit of work into the queue. | |
bool | isEmpty () const |
Test whethere the queue is empty. | |
Item | next () |
Remove and return the next item of work. More... | |
|
inline |
Remove and return the next item of work.
This is only called when isEmpty returns true.
This function is allowed to block to wait for other work to complete, which can be useful when the work list has more work to do but all that work depends on the completion of work that's already underway. Determining when the other work completes can be done by having the processWorkList functor signal a condition variable on which this function is waiting.
Definition at line 51 of file WorkList.h.