dispenso 1.5.1
A library for task parallelism
Loading...
Searching...
No Matches
spsc_ring_buffer.h File Reference
#include <atomic>
#include <cstddef>
#include <new>
#include <type_traits>
#include <utility>
#include <dispenso/platform.h>
#include <dispenso/util.h>

Go to the source code of this file.

Classes

class  dispenso::SPSCRingBuffer< T, Capacity, RoundUpToPowerOfTwo >
 A lock-free single-producer single-consumer ring buffer with fixed capacity. More...
 

Detailed Description

A lock-free single-producer single-consumer (SPSC) ring buffer.

This buffer is designed for high-performance communication between exactly one producer thread and one consumer thread. It uses a fixed-capacity circular buffer with atomic head and tail pointers, providing wait-free operations in the common case.

Note
This implementation is NOT thread-safe for multiple producers or multiple consumers. Use only with exactly one producer thread and one consumer thread.

Definition in file spsc_ring_buffer.h.