Class spsc_ring_buffer¶
class spsc_ring_buffer<T> base¶
template <typename T>
struct spsc_ring_buffer { … } Single-producer/single-consumer queue backed by an external univector .
| T | Element type stored in the buffer. |
constructor spsc_ring_buffer<T>() ¶
spsc_ring_buffer() Constructs an empty queue with front and tail set to 0.
Fully qualified name: kfr::spsc_ring_buffer<T>::spsc_ring_buffer<T>()
Declared at base/univector.hpp:745
function size() ¶
size_t size() const Returns an approximate number of elements currently available for dequeue.
Fully qualified name: kfr::spsc_ring_buffer<T>::size()
Declared at base/univector.hpp:752
function try_enqueue(const T *, size_t, univector<T, Tag> &, bool) ¶
template <univector_tag Tag>
size_t try_enqueue(const T* source, size_t size, univector<T, Tag>& buffer, bool partial = false) Attempts to enqueue size elements from source into buffer.
| source | Pointer to at least size source elements. Must not overlap buffer. |
| size | Number of elements to enqueue. |
| buffer | Backing storage (its size() defines the capacity). |
| partial | When true, allow writing fewer than size elements. |
| The number of elements actually enqueued. |
Fully qualified name: kfr::spsc_ring_buffer<T>::try_enqueue(const T *, size_t, univector<T, Tag> &, bool)
Declared at base/univector.hpp:771
function try_dequeue(T *, size_t, const univector<T, Tag> &, bool) ¶
template <univector_tag Tag>
size_t try_dequeue(T* dest, size_t size, const univector<T, Tag>& buffer, bool partial = false) Attempts to dequeue size elements from buffer into dest.
| dest | Destination buffer with room for size elements. Must not overlap buffer. |
| size | Number of elements to dequeue. |
| buffer | Backing storage (its size() defines the capacity). |
| partial | When true, allow reading fewer than size elements. |
| The number of elements actually dequeued. |
Fully qualified name: kfr::spsc_ring_buffer<T>::try_dequeue(T *, size_t, const univector<T, Tag> &, bool)
Declared at base/univector.hpp:808
Fully qualified name: kfr::spsc_ring_buffer<T>
Declared at base/univector.hpp:740