2020-01-28 09:28:11 +00:00
|
|
|
#![warn(clippy::let_underscore_lock)]
|
|
|
|
|
2021-11-11 01:59:31 +00:00
|
|
|
extern crate parking_lot;
|
|
|
|
|
2020-01-28 09:28:11 +00:00
|
|
|
fn main() {
|
|
|
|
let m = std::sync::Mutex::new(());
|
|
|
|
let rw = std::sync::RwLock::new(());
|
|
|
|
|
|
|
|
let _ = m.lock();
|
|
|
|
let _ = rw.read();
|
|
|
|
let _ = rw.write();
|
2020-01-30 15:10:19 +00:00
|
|
|
let _ = m.try_lock();
|
|
|
|
let _ = rw.try_read();
|
|
|
|
let _ = rw.try_write();
|
2021-11-11 01:59:31 +00:00
|
|
|
|
|
|
|
use parking_lot::{lock_api::RawMutex, Mutex, RwLock};
|
|
|
|
|
|
|
|
let p_m: Mutex<()> = Mutex::const_new(RawMutex::INIT, ());
|
|
|
|
let _ = p_m.lock();
|
|
|
|
|
|
|
|
let p_m1 = Mutex::new(0);
|
|
|
|
let _ = p_m1.lock();
|
|
|
|
|
|
|
|
let p_rw = RwLock::new(0);
|
|
|
|
let _ = p_rw.read();
|
|
|
|
let _ = p_rw.write();
|
2020-01-28 09:28:11 +00:00
|
|
|
}
|