12#ifndef ROC_CORE_SPSC_RING_BUFFER_H_
13#define ROC_CORE_SPSC_RING_BUFFER_H_
43 static_cast<T*
>(
ptr)->~T();
87 static_cast<T*
>(
ptr)->~T();
Base class for non-copyable objects.
Shared ownership intrusive pointer.
Thread-safe lock-free single-producer single-consumer circular buffer of byte chunks.
void end_write()
End writing of a chunk. Should be called if and only if begin_write() returned non-NULL....
uint8_t * begin_read()
Begin reading of a chunk. If buffer is empty, returns NULL. Should be called from reader thread....
uint8_t * begin_write()
Begin writing of a chunk. If buffer is full, returns NULL. Should be called from writer thread....
bool is_empty() const
Check if buffer is empty.
bool is_valid() const
Check that initial allocation succeeded.
void end_read()
End reading of a chunk. Should be called if and only if begin_read() returned non-NULL....
Thread-safe lock-free single-producer single-consumer circular buffer of copyable objects.
SpscRingBuffer(IArena &arena, size_t n_elements)
Initialize.
bool push_back(const T &element)
Append element to the end of the buffer. If buffer is full, drops element and returns false....
bool pop_front(T &element)
Fetch element from the beginning of the buffer. If buffer is empty, returns false....
~SpscRingBuffer()
Deinitialize.
bool is_valid() const
Check that allocation succeeded.
bool is_empty() const
Check if buffer is empty.
Single-producer single-consumer circular buffer of byte chunks.
Commonly used types and functions.