|
|
| wfree_fifo (wfree_fifo const &)=delete |
| |
|
| wfree_fifo (wfree_fifo &&)=delete |
| |
|
wfree_fifo & | operator= (wfree_fifo const &)=delete |
| |
|
wfree_fifo & | operator= (wfree_fifo &&)=delete |
| |
| template<typename Operation > |
| bool | take_one (Operation &&operation) noexcept |
| | Take one message from the fifo slot.
|
| |
| template<typename Operation > |
| void | take_all (Operation const &operation) noexcept |
| | Take all message from the queue.
|
| |
|
tt_no_inline void | contended () noexcept |
| |
template<typename Message , typename... Args>
requires (sizeof(Message) <= slot_type::buffer_size) |
| tt_force_inline void | emplace (Args &&...args) noexcept |
| | Create an message in-place on the fifo.
|
| |
| template<typename Message , typename... Args> |
| tt_force_inline void | emplace (Args &&...args) noexcept |
| | Create an message in-place on the fifo.
|
| |
template<typename T, size_t SlotSize>
class tt::wfree_fifo< T, SlotSize >
A wait-free multiple-producer/single-consumer fifo designed for absolute performance.
Because of performance reasons the ring-buffer is 64kByte. Each slot in the ring buffer consists of a pointer and a byte buffer for storage.
The number of slots in the ring-buffer is dictated by the size of each slot and the ring-buffer size.
- Template Parameters
-
| T | Base class of the value type stored in the ring buffer. |
| SlotSize | Size of each slot, must be power-of-two. |
template<typename T , size_t SlotSize>
template<typename Operation >
| void tt::wfree_fifo< T, SlotSize >::take_all |
( |
Operation const & | operation | ) |
|
|
inlinenoexcept |
Take all message from the queue.
Reads each message from the ring buffer and passes it to a call of operation. If no message are available this function returns without calling operation.
- Parameters
-
| operation | A void(value_type const &) which is called when a message is available. |
template<typename T , size_t SlotSize>
template<typename Operation >
| bool tt::wfree_fifo< T, SlotSize >::take_one |
( |
Operation && | operation | ) |
|
|
inlinenoexcept |
Take one message from the fifo slot.
Reads one message from the ring buffer and passes it to a call of operation. If no message is available this function returns without calling operation.
- Parameters
-
| operation | A void(value_type const &) which is called when a message is available. |
- Returns
- True if a message was available in the fifo.