summaryrefslogtreecommitdiff
path: root/examples/double_mutex.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2024-05-23 20:44:02 -0400
committerBotahamec <botahamec@outlook.com>2024-05-23 20:44:02 -0400
commitfd4ee65a78ecbf376d99377a367137b0b8cdad41 (patch)
tree663b211b0da02431b2d100a270d60d48eebbefb0 /examples/double_mutex.rs
parent0926201a52f860b1f75dda2e9bd6d2e536cc5f68 (diff)
parent8ecf29cfe2a74d02b2c4bcb7f7ad1a811dc38dfe (diff)
Merge branch '0.2'
Diffstat (limited to 'examples/double_mutex.rs')
-rw-r--r--examples/double_mutex.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/double_mutex.rs b/examples/double_mutex.rs
index 621f81e..ea61f0d 100644
--- a/examples/double_mutex.rs
+++ b/examples/double_mutex.rs
@@ -1,6 +1,6 @@
use std::thread;
-use happylock::{LockCollection, Mutex, ThreadKey};
+use happylock::{collection::RefLockCollection, Mutex, ThreadKey};
const N: usize = 10;
@@ -11,7 +11,7 @@ fn main() {
for _ in 0..N {
let th = thread::spawn(move || {
let key = ThreadKey::get().unwrap();
- let lock = LockCollection::new_ref(&DATA);
+ let lock = RefLockCollection::new(&DATA);
let mut guard = lock.lock(key);
*guard.1 = (100 - *guard.0).to_string();
*guard.0 += 1;
@@ -24,8 +24,8 @@ fn main() {
}
let key = ThreadKey::get().unwrap();
- let data = LockCollection::new_ref(&DATA);
+ let data = RefLockCollection::new(&DATA);
let data = data.lock(key);
- println!("{}", *data.0);
- println!("{}", *data.1);
+ println!("{}", data.0);
+ println!("{}", data.1);
}