Skip to content

Commit f1a4041

Browse files
committed
Return status from futex_wake().
1 parent 8cd6080 commit f1a4041

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

library/std/src/sys/unix/futex.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ pub fn futex_wait(futex: &AtomicI32, expected: i32, timeout: Option<Duration>) {
6969
}
7070

7171
#[cfg(any(target_os = "linux", target_os = "android"))]
72-
pub fn futex_wake(futex: &AtomicI32) {
72+
pub fn futex_wake(futex: &AtomicI32) -> bool {
7373
unsafe {
7474
libc::syscall(
7575
libc::SYS_futex,
7676
futex as *const AtomicI32,
7777
libc::FUTEX_WAKE | libc::FUTEX_PRIVATE_FLAG,
7878
1,
79-
);
79+
) > 0
8080
}
8181
}
8282

@@ -93,12 +93,10 @@ pub fn futex_wake_all(futex: &AtomicI32) {
9393
}
9494

9595
#[cfg(target_os = "emscripten")]
96-
pub fn futex_wake(futex: &AtomicI32) {
96+
pub fn futex_wake(futex: &AtomicI32) -> bool {
9797
extern "C" {
9898
fn emscripten_futex_wake(addr: *const AtomicI32, count: libc::c_int) -> libc::c_int;
9999
}
100100

101-
unsafe {
102-
emscripten_futex_wake(futex as *const AtomicI32, 1);
103-
}
101+
unsafe { emscripten_futex_wake(futex as *const AtomicI32, 1) > 0 }
104102
}

0 commit comments

Comments
 (0)