hamcast
Version 0.7
|
#include <single_reader_queue.hpp>
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) |
A thread safe single-reader-many-writer queue implementation.
T | The element type of the queue; must provide a next pointer. |
element_type* hamcast::util::single_reader_queue< T >::front | ( | ) |
Return a pointer to the next element in the queue.
element_type* hamcast::util::single_reader_queue< T >::pop | ( | ) |
Remove the next element in the queue and return it.
void hamcast::util::single_reader_queue< T >::push | ( | element_type * | head, |
element_type * | tail | ||
) |
Add the (singly) linked list [head
, tail
] at the end of the queue.
head | The first new element. |
tail | The last new element. |
head
, tail
] should have LIFO order, because it will be read from tail to head. void hamcast::util::single_reader_queue< T >::push | ( | element_type * | new_element | ) |
Add new_element
at the end of the queue.
new_element | The element that should become the new tail of the queue. |
element_type* hamcast::util::single_reader_queue< T >::try_pop | ( | ) |
Equal to pop() but returns NULL if the queue is empty.
element_type* hamcast::util::single_reader_queue< T >::try_pop | ( | Duration | max_wait_duration | ) |
Equal to pop() but blocks at most max_wait_duration
and returns NULL on a timeout.
max_wait_duration | The maximum wait duration as a boost posix time. |