Skip to content

Commit 76725e0

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#97162
2 parents 6ef4911 + 3b70c29 commit 76725e0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

library/std/src/sys/unix/locks/futex_rwlock.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,8 @@ impl RwLock {
208208

209209
// Don't go to sleep if the lock has become available,
210210
// or if the writers waiting bit is no longer set.
211-
let s = self.state.load(Relaxed);
212-
if is_unlocked(state) || !has_writers_waiting(s) {
213-
state = s;
211+
state = self.state.load(Relaxed);
212+
if is_unlocked(state) || !has_writers_waiting(state) {
214213
continue;
215214
}
216215

0 commit comments

Comments
 (0)