parking_lot (Rust)

High-performance synchronization primitives for Rust that replace std::sync::Mutex, RwLock, and Condvar. parking_lot's Mutex is significantly smaller (1 byte vs 40 bytes), faster, and supports additional features like fair locking, try_lock_for with timeout, and deadlock detection in debug mode. Does not poison on panic (unlike std Mutex). Used by many high-performance Rust crates.

Evaluated Mar 06, 2026 (0d ago) v0.12+
Homepage ↗ Repo ↗ Developer Tools rust mutex rwlock condvar synchronization performance lock open-source
⚙ Agent Friendliness
66
/ 100
Can an agent use this?
🔒 Security
88
/ 100
Is it safe for agents?
⚡ Reliability
87
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
82
Error Messages
78
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
88
Auth Strength
88
Scope Granularity
88
Dep. Hygiene
90
Secret Handling
88

Memory safety guaranteed by Rust. No poisoning behavior means panics in locked sections require careful application design. No known security vulnerabilities.

⚡ Reliability

Uptime/SLA
88
Version Stability
88
Breaking Changes
88
Error Recovery
85
AF Security Reliability

Best When

You're using synchronous Rust code and want faster, smaller, feature-richer synchronization primitives than std::sync provides.

Avoid When

You're writing async code — use tokio::sync equivalents. Or if you need lock poisoning semantics from std.

Use Cases

  • Replace std::sync::Mutex with parking_lot::Mutex for better performance and smaller memory footprint
  • Use try_lock_for(Duration) with timeout to avoid indefinite blocking in time-sensitive concurrent code
  • Enable deadlock detection in development builds via the deadlock_detection cargo feature
  • Use parking_lot::RwLock for reader-writer locking with fair scheduling to prevent writer starvation
  • Avoid mutex poisoning issues — parking_lot locks remain usable after thread panics unlike std::sync::Mutex

Not For

  • Async code with Tokio — parking_lot is synchronous; use tokio::sync::Mutex for async-safe locking
  • Applications where lock poisoning (std behavior) is a desired safety feature
  • Code that needs to run in no_std environments — parking_lot requires OS thread parking

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Library with no auth requirement.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Free and open source.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • parking_lot Mutex does NOT poison on panic — unlike std::sync::Mutex which returns PoisonError after a thread panics, parking_lot continues working; this can hide bugs where data is in inconsistent state after panic
  • Holding a parking_lot MutexGuard across an .await point causes deadlocks in async code — tokio::sync::Mutex is designed for async; use it instead
  • parking_lot's lock() method never fails (no PoisonError) — code that was handling PoisonError from std::sync should remove that handling when migrating to parking_lot
  • fair() locking mode prevents starvation but reduces throughput — only use fair locking when writer/reader starvation is observed, not by default
  • Deadlock detection requires enabling the 'deadlock_detection' cargo feature AND calling deadlock::check_deadlock() periodically — it's not automatic
  • parking_lot Mutex is not Send across async boundary — wrap in Arc<parking_lot::Mutex> for shared ownership; same as std but important to remember when migrating

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for parking_lot (Rust).

$99

Scores are editorial opinions as of 2026-03-06.

5220
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered