denyhosts/clamav/libclamav_rust/.cargo/vendor/spin/examples/debug.rs

22 lines
432 B
Rust
Raw Permalink Normal View History

2023-01-14 18:28:39 +08:00
extern crate spin;
fn main() {
let mutex = spin::Mutex::new(42);
println!("{:?}", mutex);
{
let x = mutex.lock();
println!("{:?}, {:?}", mutex, *x);
}
let rwlock = spin::RwLock::new(42);
println!("{:?}", rwlock);
{
let x = rwlock.read();
println!("{:?}, {:?}", rwlock, *x);
}
{
let x = rwlock.write();
println!("{:?}, {:?}", rwlock, *x);
}
}