parking_lot

A faster, smaller drop-in replacement for Rust's standard library Mutex, RwLock, Condvar, and Once.

Library
Cargo
v0.12.5
3,400stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
65/100Good
Development Activity60
Maintenance36
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
82/100Excellent
Architecture88
Code Quality82
Innovation85
Learning Curve74

parking_lot provides Mutex, RwLock, Condvar, and Once implementations that are smaller, faster, and more flexible than the ones in Rust’s standard library, plus a ReentrantMutex for recursive locking. It’s built on a low-level “parking lot” API (in the companion parking_lot_core crate) — the same design pattern used by WebKit’s JavaScriptCore — that manages queues of parked (blocked) threads efficiently, letting the higher-level lock types stay as small as a single byte or word instead of allocating OS-specific primitives on the heap.

Benchmarks in the README show parking_lot’s Mutex roughly 1.5x faster than std::sync::Mutex when uncontended and up to 5x faster under contention, with RwLock seeing gains up to 50x in some multi-reader scenarios. The crate is one of the most-depended-upon in the Rust ecosystem (nearly a billion total downloads), used transitively by countless other crates that need efficient synchronization primitives — including the type-safe generic lock API it publishes separately as lock_api, which other crates use to build their own custom lock types on the same fast core.

What You Get

  • Mutex, RwLock, Condvar, and Once types that are drop-in faster replacements for std::sync equivalents
  • A ReentrantMutex type supporting recursive locking, which std::sync does not provide
  • A low-level parking_lot_core API for building custom synchronization primitives on the same efficient thread-parking mechanism
  • lock_api, a type-safe generic lock API that other crates use to implement their own Mutex/RwLock-like types
  • Optional features: fair mutexes, hardware lock elision on supported x86 processors, deadlock detection, and serde support

Common Use Cases

  • Replacing std::sync::Mutex/RwLock in performance-sensitive multi-threaded Rust code to cut contention overhead
  • Building custom lock types on top of lock_api’s generic RawMutex/RawRwLock traits
  • Using ReentrantMutex where a thread may need to re-acquire a lock it already holds
  • Debugging deadlocks in production via the optional deadlock-detection feature that periodically scans for cycles

Under The Hood

Architecture — The crate’s public types (mutex.rs 385 lines, rwlock.rs 659 lines, condvar.rs 1,273 lines, once.rs 498 lines) are thin wrappers around raw primitive implementations (raw_mutex.rs, raw_rwlock.rs 1,158 lines) that in turn build on the separately-published parking_lot_core crate (in core/src/), which implements the actual parking-lot algorithm: a global hash table of wait queues (word_lock.rs, parking_lot.rs) that lets threads park/unpark without each lock needing its own OS-level primitive. lock_api sits alongside as a generic, type-safe trait layer (RawMutex, RawRwLock) that both this crate and third-party crates build concrete lock types on top of.

Tech Stack — Pure Rust with minimal dependencies (lock_api, parking_lot_core, optional serde for serialization support), platform-specific thread-parking backends under core/src/thread_parker/ for Unix, Windows, and wasm. Uses cfg-gated optional features (hardware-lock-elision, deadlock_detection, arc_lock, send_guard) rather than always-on complexity.

Code Quality — Test coverage leans on doctests and dedicated regression tests for specific historical bugs (tests/issue_203.rs, tests/issue_392.rs), plus CI that runs under Miri (ci/miri.sh) for undefined-behavior detection — an important signal of rigor for unsafe, low-level concurrency code. Activity has slowed to ‘moderate’ per GitHub metrics, consistent with a mature, largely feature-complete crate rather than one being actively rewritten.

API Design — The types are intentionally near-identical in shape to std::sync’s Mutex/RwLock, so migration is usually a matter of swapping the import; extras like raw locking without a RAII guard and atomic write-to-read downgrading are additive rather than disruptive to that familiar API. The one real learning-curve cost is understanding the optional feature flags (fairness, elision, deadlock detection) well enough to pick the right trade-offs, since each changes performance/behavior characteristics non-trivially.

Used by 15 apps in this directory

TypeScript
55%
Other

Cap

Team Chat · Video Conferencing

20,986

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
TypeScript55%
Rust40%
Updated yesterday
Python
64%
MIT

Flowfile

Data Engineering

341

Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.

View details
83
Repo Health
81
Technical
66
Dependency
Built with
Python64%
Vue19%
TypeScript16%
Updated today
Rust
100%
Other

Fluree DB

Databases

445

A temporal, verifiable graph database with git-like branching, integrated vector/text/geo search, and RDF/SPARQL/JSON-LD/openCypher support — benchmarked at 10.4x faster than the next database on the full Wikidata dump.

View details
86
Repo Health
74
Technical
65
Dependency
Built with
Rust100%
Updated yesterday
Rust
95%
MIT

Fyrox

Game Development

9,512

A production-ready 2D/3D game engine written in Rust with a built-in scene editor, physics, and hot-reloading game scripts

View details
85
Repo Health
79
Technical
68
Dependency
Built with
Rust95%
Updated yesterday
Go
62%
MIT

hoop

Security · Monitoring

791

A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.

View details
86
Repo Health
80
Technical
66
Dependency
Built with
Go62%
Clojure20%
JavaScript10%
Updated yesterday
Rust
96%
Apache 2.0

InfluxDB

Databases · Analytics

31,705

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
86
Repo Health
76
Technical
72
Dependency
Built with
Rust96%
Updated yesterday
Rust
47%
MIT

Kuku

Note Taking

204

A local-first, open-source Markdown knowledge workspace for macOS — plain files, personal wiki and Second Brain workflows, AI-assisted diffs, and encrypted sync, built as an Obsidian alternative.

View details
73
Repo Health
67
Technical
68
Dependency
Built with
Rust47%
TypeScript40%
Updated 1 months ago
JavaScript
57%
Other

Lokus

Note Taking · Knowledge Management

774

Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.

View details
78
Repo Health
75
Technical
65
Dependency
Built with
JavaScript57%
HTML24%
Updated 1 weeks ago
Rust
87%
AGPL 3.0

ParadeDB

Search · Databases · Analytics

9,175

Born out of Y Combinator's S2023 batch, ParadeDB is a Postgres extension that delivers Elasticsearch-quality BM25 search and real-time analytics without a separate search cluster to manage.

View details
88
Repo Health
87
Technical
71
Dependency
Built with
Rust87%
PLpgSQL12%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search