1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
mod linked_hash_set;
mod shrink_to_fit;
pub mod strings;
use std::time::Duration;
pub use linked_hash_map::{Entries as LinkedHashMapEntries, LinkedHashMap};
pub use linked_hash_set::LinkedHashSet;
pub use parking_lot::{
self, Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard,
};
pub const TRY_LOCK_TIMEOUT: Duration = Duration::from_secs(300);
pub fn lock_or_panic<T>(data: &Mutex<T>) -> MutexGuard<T> {
data.try_lock_for(TRY_LOCK_TIMEOUT)
.expect("please check if reach a deadlock")
}