This class implements a simple thread-safe queue for communication among threads.
More...
#include <Quu.h>
|
int | qMax |
| max number of items in queue
|
|
int | count |
| number of items in queue
|
|
int | head |
| index of first item in buf
|
|
int | tail |
| index of first empty space in buf
|
|
T * | buf |
| where values are stored
|
|
mutex | mtx |
| used to ensure mutual exclusion
|
|
condition_variable | emptyQ |
| condition variable for empty queue
|
|
condition_variable | fullQ |
| condition variable for full queue
|
|
template<class T>
class forest::Quu< T >
This class implements a simple thread-safe queue for communication among threads.
Definition at line 28 of file Quu.h.
Constructor for Quu objects.
- Parameters
-
qMax1 | is the maximum number of elements that can be queued. |
Definition at line 56 of file Quu.h.
Destructor for Quu objects.
Definition at line 64 of file Quu.h.
Remove and return first item in the queue.
The calling thread is blocked if the queue is empty.
- Returns
- the next item in the queue
Definition at line 113 of file Quu.h.
Determine if queue is empty.
- Returns
- true if the queue is empty, else false
Definition at line 90 of file Quu.h.
Add value to the end of the queue.
The calling thread is blocked if the queue is full.
- Parameters
-
i | is the value to be added. |
Definition at line 97 of file Quu.h.
Reset the queue, discarding any contents.
This should only be used in contexts where there is a single writer, and only the writing thread should do it.
Definition at line 71 of file Quu.h.
Resize the queue, discarding any contents.
This should only be used when the queue is empty and preferably before any threads are using the Quu.
Definition at line 81 of file Quu.h.
The documentation for this class was generated from the following file:
- forest-net/cpp/include/Quu.h