Skip to content

Commit 74f8fc1

Browse files
committed
Also tries again on EAGAIN in futex_lock
1 parent d14e7f3 commit 74f8fc1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

library/std/src/sys/pal/unix/pi_futex.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ pub fn futex_lock(futex: &AtomicU32) -> io::Result<()> {
3333
)
3434
}) {
3535
Ok(_) => return Ok(()),
36-
Err(e) if e.raw_os_error() == Some(libc::EINTR) => continue,
36+
Err(e)
37+
if e.raw_os_error().is_some_and(|errno| {
38+
errno == libc::EINTR // interrupted by signal
39+
|| errno == libc::EAGAIN // owner dying, need to try again; mutex is going to be poisoned
40+
}) =>
41+
{
42+
continue;
43+
}
3744
Err(e) => return Err(e),
3845
}
3946
}

0 commit comments

Comments
 (0)