parking_method/
lib.rs

1#![doc = include_str!("../README.md")]
2#![warn(missing_docs)]
3#![warn(rustdoc::missing_crate_level_docs)]
4//! # The Locking methods
5//!
6//! There are plenty flavors on how a lock can be obtained. The normal blocking way, trying to
7//! obtain a lock, possibly with timeouts, allow a thread to lock a single RwLock multiple
8//! times. These are (zero-cost) abstracted here.
9
10pub use parking_lot::{
11    Mutex, MutexGuard, ReentrantMutex, ReentrantMutexGuard, RwLock, RwLockReadGuard,
12    RwLockWriteGuard,
13};
14/// reexport for convenience
15pub use std::time::{Duration, Instant};
16
17/// Marker for blocking locks,
18/// waits until the lock becomes available.
19pub struct Blocking;
20
21/// Marker for trying to obtain a lock in a fallible way.
22pub struct TryLock;
23
24/// Marker for recursive locking. Allows to obtain a read-lock multiple times by a single
25/// thread.
26pub struct Recursive<T>(pub T);
27
28mod readlock_method;
29pub use readlock_method::*;
30
31mod writelock_method;
32pub use writelock_method::*;
33
34mod mutex_method;
35pub use mutex_method::*;
36
37mod reentrant_mutex_method;
38pub use reentrant_mutex_method::*;