Expand description
Instrumented lock types.
This module defines a set of instrumented wrappers for the lock
types used in wgpu-core (Mutex, RwLock, and
SnatchLock) that help us understand and validate wgpu-core
synchronization.
-
The
rankedmodule defines lock types that perform run-time checks to ensure that each thread acquires locks only in a specific order, to prevent deadlocks. -
The [
observing] module defines lock types that recordwgpu-core’s lock acquisition activity to disk, for later analysis by thelock-analyzerbinary. -
The
vanillamodule defines lock types that are uninstrumented, no-overhead wrappers around the standard lock types.
If the wgpu_validate_locks config is set (either directly, i.e. with
RUSTFLAGS='--cfg wgpu_validate_locks', or via the
wgpu_validate_locks_debug cfg alias in build.rs that conditionally
enables it when debug assertions are also enabled), wgpu-core uses the
ranked module’s locks. .config/cargo.toml in the wgpu tree specifies
wgpu_validate_locks_debug, so lock validation is active by default in
wgpu CI and wgpu development trees, but not in wgpu-using applications
unless specifically requested.
If the observe_locks feature is enabled, wgpu-core uses the
[observing] module’s locks.
Otherwise, wgpu-core uses the vanilla module’s locks.
Re-exports§
pub use chosen::Mutex;pub use chosen::MutexGuard;pub use chosen::RankData;pub use chosen::RwLock;pub use chosen::RwLockReadGuard;pub use chosen::RwLockWriteGuard;