Skip to content

Commit

Permalink
Fix Ordering on WordLock (tsan detected)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomcc committed Aug 7, 2021
1 parent 26c41e4 commit 6e3c66e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/word_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl WordLock {
if let Err(x) = self.state.compare_exchange_weak(
state,
state.with_queue_head(thread_data),
Ordering::Release,
Ordering::AcqRel,
Ordering::Relaxed,
) {
return x;
Expand Down Expand Up @@ -189,7 +189,7 @@ impl WordLock {
match self.state.compare_exchange_weak(
state,
state | QUEUE_LOCKED_BIT,
Ordering::Acquire,
Ordering::AcqRel,
Ordering::Relaxed,
) {
Ok(_) => break,
Expand Down Expand Up @@ -230,7 +230,7 @@ impl WordLock {
match self.state.compare_exchange_weak(
state,
state & !QUEUE_LOCKED_BIT,
Ordering::Release,
Ordering::AcqRel,
Ordering::Relaxed,
) {
Ok(_) => return,
Expand All @@ -249,7 +249,7 @@ impl WordLock {
match self.state.compare_exchange_weak(
state,
state & LOCKED_BIT,
Ordering::Release,
Ordering::AcqRel,
Ordering::Relaxed,
) {
Ok(_) => break,
Expand Down

0 comments on commit 6e3c66e

Please sign in to comment.