Skip to content

Commit

Permalink
Fixes try_borrow on contended lock
Browse files Browse the repository at this point in the history
  • Loading branch information
zakarumych committed Jan 22, 2023
1 parent f7bcfd8 commit 42cf408
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "atomicell"
version = "0.1.8"
version = "0.1.9"
edition = "2021"
description = "Multi-threaded RefCell on atomics"
keywords = ["atomic", "cell", "refcell"]
Expand Down
4 changes: 3 additions & 1 deletion src/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ pub fn try_borrow(lock: &Lock) -> bool {
.compare_exchange_weak(val, val + 1, Ordering::Acquire, Ordering::Relaxed)
.is_ok();

return ok;
if ok {
return true;
}
}
}

Expand Down

0 comments on commit 42cf408

Please sign in to comment.