Queue class which is thread safe, eg. multiple threads may use it at the same time.
More...
#include <ThreadSafeQueue.hpp>
|
|
| ThreadSafeQueue () |
| | constructor
|
| |
| bool | empty () |
| | test if the queue is empty More...
|
| |
| void | push (T wp) |
| | add data to the queue More...
|
| |
| bool | try_pop (T *wp) |
| | try to pop data from the queue. If no data is available then false is returned if data is available then true is returned and wp is set. More...
|
| |
| bool | pop (T *wp) |
| | pop data from the queue in blocking manner. That is it will wait until data is added to the queue if it is initially empty. More...
|
| |
| bool | has (T value) |
| | test if the queue contain a specific data value. This is slow O(N) so keep that in mind when using it. More...
|
| |
| bool | popAndPrint (T *wp) |
| | Pop data from the queue in blocking manner and print the element to standard output. More...
|
| |
| size_t | size () |
| | Get the size of the queue. More...
|
| |
template<class T>
class rw::common::ThreadSafeQueue< T >
Queue class which is thread safe, eg. multiple threads may use it at the same time.
◆ empty()
test if the queue is empty
- Returns
- true if queue is empty, false otherwise
◆ has()
test if the queue contain a specific data value. This is slow O(N) so keep that in mind when using it.
- Parameters
-
| value | [in] the value to compare with. |
- Returns
◆ pop()
pop data from the queue in blocking manner. That is it will wait until data is added to the queue if it is initially empty.
- Parameters
-
| wp | [out] data that is popped from the queue |
- Returns
◆ popAndPrint()
| bool popAndPrint |
( |
T * |
wp | ) |
|
|
inline |
Pop data from the queue in blocking manner and print the element to standard output.
- Parameters
-
| wp | [out] data that is popped from the queue. |
- Returns
- true.
◆ push()
add data to the queue
- Parameters
-
| wp | [in] data to add to queue |
◆ size()
Get the size of the queue.
- Returns
- the size.
◆ try_pop()
try to pop data from the queue. If no data is available then false is returned if data is available then true is returned and wp is set.
- Parameters
-
- Returns
- true is wp set, false otherwise
The documentation for this class was generated from the following file: