![]() |
KASKADE 7 development version
|
A concurrent fifo queue. More...
#include <threading.hh>
Public Member Functions | |
| ConcurrentQueue () | |
| Constructs an empty queue. | |
| ConcurrentQueue (ConcurrentQueue &&q) | |
| Moves a queue. | |
| ConcurrentQueue & | operator= (ConcurrentQueue const &q) |
| Assignment. | |
| bool | empty () const |
| size_t | size () const |
| Returns the number of tasks waiting. | |
| void | push_back (T &&t) |
| Stores an element at the end of the queue. | |
| T | pop_front () |
| Retrieves the foremost element. | |
| int | running (int n) |
| Change the number of running worker threads. | |
| int | running () const |
| Get the number of running worker threads. | |
A concurrent fifo queue.
The queue is not copyable as it is intended to hold non-copyable std:packaged_task objects.
Definition at line 134 of file threading.hh.
|
inline |
Constructs an empty queue.
Definition at line 139 of file threading.hh.
Referenced by ConcurrentQueue(), and operator=().
|
inline |
Moves a queue.
This transferres all tasks waiting in q to the newly constructed queue, but leaves q intact.
Definition at line 149 of file threading.hh.
|
inline |
Definition at line 167 of file threading.hh.
|
inline |
Assignment.
This copies all tasks waiting in q to the newly constructed queue, but leaves q intact.
Definition at line 160 of file threading.hh.
|
inline |
Retrieves the foremost element.
This method blocks if the queue is empty and waits for data to become available.
Definition at line 201 of file threading.hh.
|
inline |
Stores an element at the end of the queue.
Definition at line 187 of file threading.hh.
|
inline |
Get the number of running worker threads.
Definition at line 233 of file threading.hh.
|
inline |
Change the number of running worker threads.
| n | if 1, increment the number of running workers, if -1, decrement it. |
Definition at line 222 of file threading.hh.
|
inline |
Returns the number of tasks waiting.
Definition at line 177 of file threading.hh.