We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5fae61e commit 80f8285Copy full SHA for 80f8285
library/std/src/sys/pal/unix/locks/pthread_mutex.rs
@@ -112,6 +112,13 @@ impl Mutex {
112
}
113
114
let r = libc::pthread_mutex_lock(raw(self));
115
+ // As we set the mutex type to `PTHREAD_MUTEX_NORMAL` above, we expect
116
+ // the lock call to never fail. Unfortunately however, some platforms
117
+ // (Solaris) do not conform to the standard, and instead always provide
118
+ // deadlock detection. How kind of them! Unfortunately that means that
119
+ // we need to check the error code here. To save use from UB on other
120
+ // less well-behaved platforms in the future, we do it even on "good"
121
+ // platforms like macOS. See #120147 for more context.
122
if r != 0 {
123
fail()
124
0 commit comments