# rigtorp/SPSCQueue

A bounded single-producer single-consumer wait-free and lock-free queue written in C++11

Repository: https://github.com/rigtorp/SPSCQueue
Canonical: https://ross.abutalabs.com/products/spscqueue
Language: C++
License: MIT
License Family: permissive
Topics: queue, concurrency, concurrent-data-structure, lock-free, spsc-queue, cpp11, cpp, header-only
Last push: 2024-01-04T14:24:22+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 3810, "days_push": 972, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1280, forks 166 (observed 2026-08-28T04:04:13.706615+00:00)

## What it is
A header-only C++11 library providing a bounded single-producer single-consumer wait-free and lock-free queue. It is optimized for high-performance inter-thread communication and claims to outperform boost::lockfree::spsc and folly::ProducerConsumerQueue.

## Use cases
- pass messages between two threads with minimal latency
- implement a lock-free producer-consumer pipeline in C++
- replace boost::lockfree::spsc_queue with a faster alternative
- build a fixed-capacity ring buffer for inter-thread data transfer
- share data between one writer and one reader thread without locks

## When to choose
- you have exactly one producer thread and one consumer thread
- you need wait-free, bounded queue semantics with predictable latency
- you want a dependency-free header-only C++11 solution
- throughput and cache efficiency matter more than dynamic sizing

## When to avoid
- you need multiple producers or multiple consumers
- you need an unbounded or dynamically growing queue
- you need blocking with condition variables or cross-thread wakeup built in
- you are not programming in C++

## Facets
- artifact type: library
- maturity: stable
- function: concurrency, message-queue
- domain: developer-tools, performance
- platform: cpp, cross-platform
- tags: lock-free, spsc-queue, header-only, wait-free, single-producer-single-consumer, cpp11, algorithms

## Member repositories
- rigtorp/SPSCQueue (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:13.706615+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:02:38.788678+00:00, confidence not recorded.
  - readme: https://github.com/rigtorp/SPSCQueue (fetched 2026-08-28T04:04:13.706615+00:00, sha 97c0738b764c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
