Lock-free FIFO queue. Uses auto-expanding freelist allocator so memory is only reclaimed upon destruction.
More...
|
| | Queue (szt capacity=0) |
| |
| | ~Queue () |
| |
| void | reserve (szt capacity) |
| | Ensure that enough storage is allocated for a number of elements. More...
|
| |
| szt | capacity () const |
| | The number of elements for which storage is allocated. More...
|
| |
| template<class T_ > |
| void | push (T_ &&val) |
| | Add new element constructed with val onto the end of the queue. More...
|
| |
| bool | pop (optional< T & > val=optnull) |
| | Remove oldest element from the queue and copy it into val. Returns true on success, false if there is no element to pop. More...
|
| |
| bool | front (T &val) |
| | Get a copy of the next element that will be popped. Returns true on success, false if there is no element. More...
|
| |
| bool | back (T &val) |
| | Get a copy of the last element. Returns true on success, false if there is no element. More...
|
| |
| void | clear () |
| | Remove all elements. More...
|
| |
| bool | empty () const |
| | Check whether the queue does not contain any elements. More...
|
| |
| szt | size () const |
| | The number of elements in the queue. More...
|
| |
template<class T>
class honey::lockfree::Queue< T >
Lock-free FIFO queue. Uses auto-expanding freelist allocator so memory is only reclaimed upon destruction.
Based on the paper: "Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms", Michael, Scott - 1996