diff options
Diffstat (limited to 'vendor/spin/examples')
-rw-r--r-- | vendor/spin/examples/debug.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/spin/examples/debug.rs b/vendor/spin/examples/debug.rs new file mode 100644 index 0000000..64654f6 --- /dev/null +++ b/vendor/spin/examples/debug.rs @@ -0,0 +1,21 @@ +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); + } +} |