cameron314/concurrentqueue

A fast multi-producer, multi-consumer lock-free concurrent queue for C++11

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 33 minutes ago
Added to GitGenius on September 4th, 2026
Created on November 6th, 2014
Open Issues & Pull Requests: 77 (+0)
GitHub issues: Enabled
Number of forks: 1,932
Total Stargazers: 12,484 (+0)
Total Subscribers: 335 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

moodycamel::ConcurrentQueue is a lock-free concurrent queue for C++11 that supports multiple producers and consumers.

The queue solves the problem of safely sharing data between threads without the performance overhead of traditional locking mechanisms. It uses a lock-free design based on atomic operations and careful memory management to allow concurrent access from any number of threads. Elements are moved rather than copied where possible, and the implementation supports both dynamic allocation and pre-allocated memory pools. A key distinguishing feature is its support for bulk enqueueing and dequeueing operations, which can approach or exceed the performance of non-concurrent queues even under heavy contention.

Developers should choose this queue when they need to pass data between multiple threads and performance is critical. It works well for applications that can tolerate its non-linearizable semantics, meaning elements from different producers may not maintain a global ordering if those producers coordinate with each other, though each individual producer's elements maintain their order. The single-header design makes integration straightforward. Compared to alternatives like Boost's concurrent queue, which restricts element types to those with trivial assignment operators and destructors, this implementation accepts arbitrary element types. Intel's TBB queue, while available, is not lock-free and requires trivial constructors. The queue includes a blocking variant for scenarios where threads need to wait for elements to become available.

The project maintains a focused scope on the core queue implementation with steady attention to correctness and performance. Development activity shows consistent engagement with bug reports and pull requests, indicating active maintenance of the codebase. The single-header architecture is preserved across updates, maintaining the ease of integration that characterizes the project. Testing remains a priority, with the implementation validated against the design claims through benchmarking and correctness verification.