diff --git a/Cargo.lock b/Cargo.lock index a6f4435..21f2171 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,4 +4,4 @@ version = 3 [[package]] name = "microlock" -version = "0.2.0" +version = "0.2.1" diff --git a/README.md b/README.md index b768f99..24c3fc0 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ fn main() { thread::spawn(move || loop { LOCK.wait_here(); println!("{}", queue2.lock().unwrap().pop_front().unwrap()); - LOCK.lock(); + // try_lock because another unlock *could*ve happened since then + LOCK.try_lock(); }); let timer = TimedLock::unlocked(); diff --git a/examples/channel.rs b/examples/channel.rs index dfb7f21..1a6fae8 100644 --- a/examples/channel.rs +++ b/examples/channel.rs @@ -13,7 +13,8 @@ fn main() { thread::spawn(move || loop { LOCK.wait_here(); println!("{}", queue2.lock().unwrap().pop_front().unwrap()); - LOCK.lock(); + // try_lock because another unlock *could*ve happened since then + LOCK.try_lock(); }); let timer = TimedLock::unlocked();