Skip to content

Commit c9083c8

Browse files
committed
Clarify feature selection
1 parent d8c559f commit c9083c8

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/lib.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,23 @@
1818
//! # Structure
1919
//!
2020
//! Each module in this crate exposes wrappers for a specific base-mutex with dependency trakcing
21-
//! added. For now, that is limited to [`stdsync`] which provides wrappers for the base locks in the
22-
//! standard library. More back-ends may be added as features in the future.
21+
//! added. This includes [`stdsync`] which provides wrappers for the base locks in the standard
22+
//! library, and more depending on enabled compile-time features. More back-ends may be added as
23+
//! features in the future.
24+
//!
25+
//! # Feature flags
26+
//!
27+
//! `tracing-mutex` uses feature flags to reduce the impact of this crate on both your compile time
28+
//! and runtime overhead. Below are the available flags. Modules are annotated with the features
29+
//! they require.
30+
//!
31+
//! - `backtraces`: Enables capturing backtraces of mutex dependencies, to make it easier to
32+
//! determine what sequence of events would trigger a deadlock. This is enabled by default, but if
33+
//! the performance overhead is unaccceptable, it can be disabled by disabling default features.
34+
//!
35+
//! - `lockapi`: Enables the wrapper lock for [`lock_api`][lock_api] locks
36+
//!
37+
//! - `parkinglot`: Enables wrapper types for [`parking_lot`][parking_lot] mutexes
2338
//!
2439
//! # Performance considerations
2540
//!
@@ -44,7 +59,13 @@
4459
//! (such as [`stdsync::Mutex`]) which evaluate to a tracing mutex when debug assertions are
4560
//! enabled, and to the underlying mutex when they're not.
4661
//!
62+
//! For ease of debugging, this crate will, by default, capture a backtrace when establishing a new
63+
//! dependency between two mutexes. This has an additional overhead of over 60%. If this additional
64+
//! debugging aid is not required, it can be disabled by disabling default features.
65+
//!
4766
//! [paper]: https://whileydave.com/publications/pk07_jea/
67+
//! [lock_api]: https://docs.rs/lock_api/0.4/lock_api/index.html
68+
//! [parking_lot]: https://docs.rs/parking_lot/0.12.1/parking_lot/
4869
#![cfg_attr(docsrs, feature(doc_cfg))]
4970
use std::cell::RefCell;
5071
use std::fmt;

0 commit comments

Comments
 (0)