implements a lock free queue (i.e. container with FIFO order) of elements of type T with a fixed Capacity
More...
#include <lockfree_queue.hpp>
|
using | element_t = ElementType |
|
|
using | Queue = IndexQueue< Capacity > |
|
using | BufferIndex = typename Queue::value_t |
|
|
template<typename T > |
void | writeBufferAt (const BufferIndex &, T &&) |
|
template<typename T > |
iox::cxx::optional< ElementType > | pushImpl (T &&value) noexcept |
|
cxx::optional< ElementType > | readBufferAt (const BufferIndex &) |
|
|
Queue | m_freeIndices |
|
Queue | m_usedIndices |
|
Buffer< ElementType, Capacity, BufferIndex > | m_buffer |
|
std::atomic< uint64_t > | m_size {0u} |
|
template<typename ElementType, uint64_t Capacity>
class iox::concurrent::LockFreeQueue< ElementType, Capacity >
implements a lock free queue (i.e. container with FIFO order) of elements of type T with a fixed Capacity
◆ capacity()
template<typename ElementType , uint64_t Capacity>
returns the capacity of the queue
- Note
- threadsafe, lockfree
◆ empty()
template<typename ElementType , uint64_t Capacity>
check whether the queue is empty
- Returns
- true iff the queue is empty
- Note
- that if the queue is used concurrently it might not be empty anymore after the call (but it was at some point during the call)
-
threadsafe, lockfree
◆ pop()
template<typename ElementType , uint64_t Capacity>
tries to remove value in FIFO order
- Returns
- value if removal was successful, empty optional otherwise
- Note
- threadsafe, lockfree
◆ push() [1/2]
template<typename ElementType , uint64_t Capacity>
inserts value in FIFO order, always succeeds by removing the oldest value when the queue is detected to be full (overflow)
- Parameters
-
value | to be inserted is copied into the queue |
- Returns
- removed value if an overflow occured, empty optional otherwise
- Note
- threadsafe, lockfree
◆ push() [2/2]
template<typename ElementType , uint64_t Capacity>
inserts value in FIFO order, always succeeds by removing the oldest value when the queue is detected to be full (overflow)
- Parameters
-
value | to be inserted is moved into the queue if possible |
- Returns
- removed value if an overflow occured, empty optional otherwise
- Note
- threadsafe, lockfree
◆ size()
template<typename ElementType , uint64_t Capacity>
get the number of stored elements in the queue
- Returns
- number of stored elements in the queue
- Note
- that this will not be perfectly in sync with the actual number of contained elements during concurrent operation but will always be at most capacity
-
threadsafe, lockfree
◆ tryPush() [1/2]
template<typename ElementType , uint64_t Capacity>
tries to insert value in FIFO order, copies the value internally
- Parameters
-
- Returns
- true if insertion was successful (i.e. queue was not full during push), false otherwise
- Note
- threadsafe, lockfree
◆ tryPush() [2/2]
template<typename ElementType , uint64_t Capacity>
tries to insert value in FIFO order, moves the value internally
- Parameters
-
- Returns
- true if insertion was successful (i.e. queue was not full during push), false otherwise
- Note
- threadsafe, lockfree
The documentation for this class was generated from the following files:
- iceoryx_utils/concurrent/lockfree_queue.hpp
- iceoryx_utils/internal/concurrent/lockfree_queue/lockfree_queue.inl