Skip to content

Commit

Permalink
fallback: Remove unnecessary read in compare_exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Aug 8, 2022
1 parent 3464f8e commit 25c2957
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/imp/fallback/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,9 @@ macro_rules! atomic {
self.write(new, &guard);
Ok(result)
} else {
let val = self.read(&guard);
// The value hasn't been changed. Drop the guard without incrementing the stamp.
guard.abort();
Err(val)
Err(result)
}
}

Expand Down

0 comments on commit 25c2957

Please sign in to comment.