A thread safe single-reader-many-writer queue implementation.
More...
#include <single_reader_queue.hpp>
List of all members.
Public Member Functions |
element_type * | pop () |
element_type * | try_pop () |
template<typename Duration > |
element_type * | try_pop (Duration max_wait_duration) |
element_type * | front () |
void | push (element_type *head, element_type *tail) |
void | push (element_type *new_element) |
Detailed Description
template<typename T>
class hamcast::util::single_reader_queue< T >
A thread safe single-reader-many-writer queue implementation.
- Parameters:
-
| T | The element type of the queue; must provide a next pointer. |
Member Function Documentation
Return a pointer to the next element in the queue.
- Returns:
- NULL if the is empty; otherwise a pointer to the next element.
Remove the next element in the queue and return it.
- Note:
- This function blocks on an empty queue.
- Returns:
- The removed (previously the first) element.
Add the (singly) linked list [head
, tail
] at the end of the queue.
- Parameters:
-
| head | The first new element. |
| tail | The last new element. |
- Warning:
- The list [
head
, tail
] should have LIFO order, because it will be read from tail to head.
Add new_element
at the end of the queue.
- Parameters:
-
| new_element | The element that should become the new tail of the queue. |
Equal to pop() but returns NULL if the queue is empty.
- Returns:
- NULL if the queue was empty; otherwise the removed element.
template<typename T>
template<typename Duration >
Equal to pop() but blocks at most max_wait_duration
and returns NULL on a timeout.
- Parameters:
-
| max_wait_duration | The maximum wait duration as a boost posix time. |
- Returns:
- NULL on a timeout; otherwise the removed element.
The documentation for this class was generated from the following file:
- hamcast/util/single_reader_queue.hpp