Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type RingBuffer ¶
type RingBuffer[T any] struct { // contains filtered or unexported fields }
RingBuffer represents the MPMC ring buffer
func (*RingBuffer[T]) Read ¶
func (rb *RingBuffer[T]) Read() (T, error)
Read reads data from the ring buffer by a consumer
func (*RingBuffer[T]) Write ¶
func (rb *RingBuffer[T]) Write(value T) error
Write writes data into the ring buffer by a producer.
It explicitly boxes the value on the heap to ensure the pointer remains valid, avoiding reliance on compiler escape analysis for safety.
Click to show internal directories.
Click to hide internal directories.