|
18 | 18 | //! # Structure |
19 | 19 | //! |
20 | 20 | //! 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 |
23 | 38 | //! |
24 | 39 | //! # Performance considerations |
25 | 40 | //! |
|
44 | 59 | //! (such as [`stdsync::Mutex`]) which evaluate to a tracing mutex when debug assertions are |
45 | 60 | //! enabled, and to the underlying mutex when they're not. |
46 | 61 | //! |
| 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 | +//! |
47 | 66 | //! [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/ |
48 | 69 | #![cfg_attr(docsrs, feature(doc_cfg))] |
49 | 70 | use std::cell::RefCell; |
50 | 71 | use std::fmt; |
|
0 commit comments