We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6392f15 commit 321690cCopy full SHA for 321690c
library/std/src/sys/unix/locks/futex.rs
@@ -76,7 +76,9 @@ impl Mutex {
76
// while spinning, to be easier on the caches.
77
let state = self.futex.load(Relaxed);
78
79
- if state == 0 || spin == 0 {
+ // We stop spinning when the mutex is unlocked (0),
80
+ // but also when it's contended (2).
81
+ if state != 1 || spin == 0 {
82
return state;
83
}
84
0 commit comments