Lock-free, zero-allocation multi-producer single-consumer ring buffer layout for shared memory. Compatible with POD and trivially copyable types (or serialized payloads).
More...
#include <ShmMpscQueue.hpp>
|
| void | bind (void *mappedAddress, bool initializeMemory=false) noexcept |
| | Bind to a mapped shared memory region.
|
| |
| constexpr std::size_t | capacity () const noexcept |
| | Get configured capacity of the queue.
|
| |
| bool | empty () const noexcept |
| | Check if queue is currently empty.
|
| |
| bool | isValid () const noexcept |
| | Validate that the mapped shared memory contains a compatible ShmMpscQueue header.
|
| |
| | ShmMpscQueue ()=default |
| |
| | ShmMpscQueue (void *mappedAddress, bool initializeMemory=false) noexcept |
| | Construct queue bound to a mapped shared memory address.
|
| |
| bool | tryPop (T &outItem) noexcept |
| | Lock-free pop from shared memory queue (single-consumer safe).
|
| |
| template<typename U > |
| bool | tryPush (U &&item) noexcept |
| | Lock-free push into shared memory queue (multi-producer safe).
|
| |
|
| static constexpr std::size_t | requiredMemorySize () noexcept |
| | Required byte size of the shared memory layout.
|
| |
template<typename T, std::size_t Capacity = 256>
class corium::ipc::ShmMpscQueue< T, Capacity >
Lock-free, zero-allocation multi-producer single-consumer ring buffer layout for shared memory. Compatible with POD and trivially copyable types (or serialized payloads).
- Template Parameters
-
| T | Value type stored in each ring cell. |
| Capacity | Number of slots (must be a power of 2). |
◆ ShmMpscQueue() [1/2]
template<typename T , std::size_t Capacity = 256>
◆ ShmMpscQueue() [2/2]
template<typename T , std::size_t Capacity = 256>
Construct queue bound to a mapped shared memory address.
◆ bind()
template<typename T , std::size_t Capacity = 256>
Bind to a mapped shared memory region.
- Parameters
-
| mappedAddress | Pointer to shared memory. |
| initializeMemory | If true, resets header and cell sequences (creator process). |
◆ capacity()
template<typename T , std::size_t Capacity = 256>
Get configured capacity of the queue.
◆ empty()
template<typename T , std::size_t Capacity = 256>
Check if queue is currently empty.
◆ isValid()
template<typename T , std::size_t Capacity = 256>
Validate that the mapped shared memory contains a compatible ShmMpscQueue header.
◆ requiredMemorySize()
template<typename T , std::size_t Capacity = 256>
|
|
inlinestaticconstexprnoexcept |
Required byte size of the shared memory layout.
◆ tryPop()
template<typename T , std::size_t Capacity = 256>
Lock-free pop from shared memory queue (single-consumer safe).
- Parameters
-
| outItem | Reference populated with popped value. |
- Returns
- true if popped, false if queue is empty.
◆ tryPush()
template<typename T , std::size_t Capacity = 256>
template<typename U >
Lock-free push into shared memory queue (multi-producer safe).
- Parameters
-
- Returns
- true if pushed, false if queue is full.
◆ BufferCapacity
template<typename T , std::size_t Capacity = 256>
◆ BufferMask
template<typename T , std::size_t Capacity = 256>
The documentation for this class was generated from the following file: