1
0
mirror of https://github.com/bspeice/qadapt synced 2024-11-25 23:38:11 -05:00
qadapt/qadapt-spin/examples/debug.rs

22 lines
432 B
Rust
Raw Normal View History

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);
}
}