mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-06 12:04:36 +00:00
Rollup merge of #97245 - m-ou-se:rwlock-state-typo, r=JohnTitor
Fix typo in futex RwLock::write_contended. I wrote `state` where I should've used `s`. This was spotted by `@Warrenren.` This change removes the unnecessary `s` variable to prevent that mistake. Fortunately, this typo didn't affect the correctness of the lock, as the second half of the condition (!has_writers_waiting) is enough for correctness, which explains why this mistake didn't show up during testing. Fixes https://github.com/rust-lang/rust/issues/97162
This commit is contained in:
commit
76725e081d
@ -208,9 +208,8 @@ impl RwLock {
|
||||
|
||||
// Don't go to sleep if the lock has become available,
|
||||
// or if the writers waiting bit is no longer set.
|
||||
let s = self.state.load(Relaxed);
|
||||
if is_unlocked(state) || !has_writers_waiting(s) {
|
||||
state = s;
|
||||
state = self.state.load(Relaxed);
|
||||
if is_unlocked(state) || !has_writers_waiting(state) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user