Expand description
Timeout-based deadlock detection helpers.
try_lock_with_timeout wraps an async lock acquisition with a hard
deadline. If the lock cannot be acquired in time, the result is
Verdict::Fail with a deadlock_suspected tag.
§What this catches
- Real deadlock cycles (lock A waits for B, B waits for A).
- Single-lock starvation (one holder never releases).
- Long contention periods that look like deadlocks from the caller’s perspective.
§What this does NOT catch
Timeout-based detection cannot distinguish a true deadlock from a
slow-but-eventually-completing operation. For deterministic cycle
detection you’d need a lock-graph tracker, which is out of scope
for 0.x.
Functions§
- try_
mutex_ lock_ with_ timeout - Acquire a
tokio::sync::Mutexlock or fail with a deadlock-suspected verdict. - try_
rwlock_ read_ with_ timeout - Acquire a
tokio::sync::RwLockread lock or fail. - try_
rwlock_ write_ with_ timeout - Acquire a
tokio::sync::RwLockwrite lock or fail.