template<typename T>
TrinyxMPMCRing class

TrinyxMPMCRing<T> — Bounded MPMC lock-free queue (Vyukov sequence-number pattern).

  • Multiple producers, multiple consumers — all operations use CAS.
  • Capacity rounded to next power of 2 by Initialize().
  • Head and Tail are on separate cache lines to prevent false sharing.

Designed for the job system: Brain/Encoder produce, worker pool consumes.

See TrinyxRingBase for the full queue family overview.

Base classes

template<typename Derived, typename T>
class TrinyxRingBase<TrinyxMPMCRing<T>, T>

Constructors, destructors, conversion operators

TrinyxMPMCRing() defaulted
~TrinyxMPMCRing()
TrinyxMPMCRing(const TrinyxMPMCRing&) deleted

Public functions

auto operator=(const TrinyxMPMCRing&) -> TrinyxMPMCRing& deleted
auto Initialize(size_t requestedCapacity) -> bool
Allocate the backing buffer. Capacity is rounded up to the next power of 2.
void Shutdown()
auto TryPush(const T& item) -> bool
auto TryPush(T&& item) -> bool
auto TryPop(T& item) -> bool
Non-blocking dequeue. Returns false if empty.
auto IsEmpty() const -> bool