docs: document deadlock detector mutex design rationale (#744) (#4008)

docs: document deadlock detector mutex design rationale

Add comment explaining why std::sync::Mutex is used instead of
tokio::sync::Mutex in the deadlock detector.

Refs #744

Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
Zhengchao An
2026-06-28 19:29:50 +08:00
committed by GitHub
parent 27b8592879
commit 8d0ba1cd3c
+6
View File
@@ -117,6 +117,12 @@ impl Default for DeadlockDetectorConfig {
}
/// Deadlock detector.
/// Deadlock detector using wait-for graphs.
///
/// Uses `std::sync::Mutex` (not `tokio::sync::Mutex`) because:
/// - Locks are never held across `.await` points
/// - Critical sections are sub-microsecond (single HashMap operations)
/// - `tokio::sync::Mutex` would add unnecessary overhead for these short operations
pub struct DeadlockDetector {
/// Configuration.
config: DeadlockDetectorConfig,