feat(concurrency): use parking_lot for the default backend#1541
Closed
daniel-noland wants to merge 1 commit into
Closed
Conversation
11 tasks
d560e77 to
aa509ce
Compare
c712d12 to
8c6ea48
Compare
Adds `parking_lot` as the production backend behind the
`parking_lot` feature, and turns that feature on by default.
`parking_lot::{Mutex, RwLock}` already match the surface this crate
presents -- naked guards, no poison, fast contention path -- so the
default backend now pays no wrapping cost. Production builds get
the perf path; `--no-default-features` falls back to the
`std_backend` poison-as-panic wrapper from the previous PR.
* `concurrency::sync::parking_lot_backend` re-exports
`parking_lot::{Mutex, RwLock, ...Guard}` and the
`parking_lot`-shaped surface for `RwLockUpgradableReadGuard`
(`upgrade()` / `try_upgrade()` are inherited directly). Other
std-only types (`Arc`, `Weak`, `atomic`, `mpsc`, `Once`,
`OnceLock`, `Barrier`, `Condvar`) come straight from `std::sync`.
* `concurrency/src/sync/mod.rs` routes: `parking_lot` feature on
(default) -> parking_lot backend; `parking_lot` feature off ->
`std_backend`; loom / shuttle features keep their raw re-exports.
Workspace `Cargo.toml` adds `tokio/parking_lot` as a documented
exception to the "no workspace-wide features" rule. Without it,
tokio's runtime picks a different lock implementation than the
rest of the dataplane, which is divergence we don't want between
test binaries and the real dataplane process.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
aa509ce to
cdf3507
Compare
8c6ea48 to
734ff09
Compare
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parking_lotCargo feature (enabled by default) and aconcurrency/src/sync/parking_lot_backend.rsthat is a zero-cost re-export ofparking_lot::{Mutex, RwLock}plus the std re-exports for everythingparking_lotdoesn't ship (Arc,Weak, atomics,Condvar, ...).concurrency/src/sync/mod.rspicksparking_lot_backendwhenfeature = "parking_lot"is on, falls back tostd_backendotherwise._strict_provenancefeature overridesparking_lotand routes throughstd_backend:parking_lot_core::word_lockuses integer-to-pointer casts that-Zmiri-strict-provenancerejects, and the CI miri job (--features=_strict_provenance) exercises the fallback slot, which needsstd::syncunderneath.Cargo.tomlgets atokioparking_lot override entry so thetokioparking_lot feature is enabled workspace-wide.PR 3 of 6. Depends on #1540 — facade-std. The next PR sweeps the workspace data-path crates to consume the facade.