MPMCQueue
lastmod 2026-11-10created 2020-08-072 edits
MPMCQueue is a bounded multi-producer, multi-consumer lock-free queue written in C++11. Even when multiple threads push and pop at the same time, it works with atomic operations alone and no mutex; it handles contention by giving each slot a sequence number (ticket) and avoids false sharing through cache-line alignment. It consists of a single header, so it is easy to add to a project, and it is used for high-performance inter-thread message passing or work queues.
A bounded multi-producer multi-consumer lock-free queue written in C++11.