cameron314/readerwriterqueue

A fast single-producer, single-consumer lock-free queue for C++

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 10 minutes ago
Added to GitGenius on September 14th, 2026
Created on February 7th, 2013
Open Issues & Pull Requests: 21 (+0)
GitHub issues: Enabled
Number of forks: 736
Total Stargazers: 4,624 (+0)
Total Subscribers: 145 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 11.7 hours
Mean response time: 4.3 days
90th percentile: 12.5 days
Tracked items: 13

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 8
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 758 days
Stale 30+ days: 7
Stale 90+ days: 7

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

readerwriterqueue is a lock-free queue for C++ that serves single-producer, single-consumer use cases with minimal synchronization overhead.

The queue solves the problem of coordinating data transfer between two threads without locks, which can cause contention and unpredictable latency. It achieves this through a wait-free design where enqueue and dequeue operations are always O(1) and compile down to simple loads, stores, and branches on x86 platforms, with no compare-and-swap loops. Memory is allocated upfront in contiguous blocks, and the queue provides both a non-blocking try_enqueue method that never allocates and a dynamic enqueue method for growing capacity as needed.

Developers should choose this queue when building systems where two threads need to exchange data with predictable, minimal latency and no lock contention. It suits real-time applications, high-frequency trading systems, and other performance-critical scenarios. The tool is not suitable for multi-producer or multi-consumer patterns; the README notes that a separate multi-producer, multi-consumer implementation exists for those cases. The queue also offers a circular-buffer variant that supports blocking on both enqueue and dequeue operations, providing flexibility for different synchronization patterns.

The project maintains a focused scope on the single-producer, single-consumer case and has been tested primarily on x86 and x86-64 platforms. The implementation is header-only and requires only a modern C++ compiler, making integration straightforward. The codebase includes both a standard queue and a circular-buffer variant, each with blocking and non-blocking methods, giving users options for their specific threading model.