|
cds
1.4.0
|
Non-blocking cyclic queue discovered by Philippas Tsigas and Yi Zhang. More...
#include <cds/intrusive/tsigas_cycle_queue.h>
Data Structures | |
| struct | rebind |
| Rebind template arguments. More... | |
Public Types | |
| typedef T | value_type |
| type of value stored in the queue | |
| typedef options::item_counter | item_counter |
| Item counter type. | |
| typedef options::disposer | disposer |
| Item disposer. | |
| typedef options::back_off | back_off |
| back-off strategy used | |
| typedef options::memory_model | memory_model |
| Memory ordering. See cds::opt::memory_model option. | |
Public Member Functions | |
| TsigasCycleQueue (size_t nCapacity=0) | |
Initialize empty queue of capacity nCapacity. More... | |
| ~TsigasCycleQueue () | |
| Clears the queue. | |
| size_t | size () const noexcept() |
| Returns queue's item count. More... | |
| size_t | capacity () const noexcept() |
| Returns capacity of cyclic buffer. | |
| bool | enqueue (value_type &data) |
| Enqueues item from the queue. More... | |
| value_type * | dequeue () |
| Dequeues item from the queue. More... | |
| bool | push (value_type &data) |
| Synonym of enqueue. | |
| value_type * | pop () |
| Synonym of dequeue. | |
| bool | empty () const |
| Checks if the queue is empty. | |
| template<typename Disposer > | |
| void | clear (Disposer f) |
| Clears queue in lock-free manner. More... | |
| void | clear () |
| Clears the queue. More... | |
Non-blocking cyclic queue discovered by Philippas Tsigas and Yi Zhang.
Source:
Template arguments:
T. Restriction: the queue can manage at least two-byte aligned data: the least significant bit (LSB) of any pointer stored in the queue must be zero since the algorithm may use LSB as a flag that marks the free cell.Options are:
This queue algorithm does not require any garbage collector.
|
inline |
Initialize empty queue of capacity nCapacity.
For cds::opt::v::static_buffer the nCapacity parameter is ignored.
Note that the real capacity of queue is nCapacity - 2.
|
inline |
Clears queue in lock-free manner.
f parameter is a functor to dispose removed items. The interface of DISPOSER is:
You can pass disposer by reference using boost::ref. The disposer will be called immediately for each item.
|
inline |
Clears the queue.
This function uses the disposer that is specified in Options.
|
inline |
|
inline |
|
inlinenoexcept |
Returns queue's item count.
The value returned depends on opt::item_counter option. For atomicity::empty_item_counter, this function always returns 0.