diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2022-04-06 16:30:49 +0200 | 
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2022-04-07 11:34:35 +0200 | 
| commit | f1a40410ecce3c1b115e244c7e189e019e226c13 (patch) | |
| tree | 0fd440c7667313056291329a277fcdf28330b282 /library/std/src/sys/unix/futex.rs | |
| parent | 8cd6080f6c778f6664ea3d12ca7848231707a627 (diff) | |
| download | rust-f1a40410ecce3c1b115e244c7e189e019e226c13.tar.gz rust-f1a40410ecce3c1b115e244c7e189e019e226c13.zip | |
Return status from futex_wake().
Diffstat (limited to 'library/std/src/sys/unix/futex.rs')
| -rw-r--r-- | library/std/src/sys/unix/futex.rs | 10 | 
1 files changed, 4 insertions, 6 deletions
| diff --git a/library/std/src/sys/unix/futex.rs b/library/std/src/sys/unix/futex.rs index c61d948fb60..4231241a142 100644 --- a/library/std/src/sys/unix/futex.rs +++ b/library/std/src/sys/unix/futex.rs @@ -69,14 +69,14 @@ pub fn futex_wait(futex: &AtomicI32, expected: i32, timeout: Option<Duration>) { } #[cfg(any(target_os = "linux", target_os = "android"))] -pub fn futex_wake(futex: &AtomicI32) { +pub fn futex_wake(futex: &AtomicI32) -> bool { unsafe { libc::syscall( libc::SYS_futex, futex as *const AtomicI32, libc::FUTEX_WAKE | libc::FUTEX_PRIVATE_FLAG, 1, - ); + ) > 0 } } @@ -93,12 +93,10 @@ pub fn futex_wake_all(futex: &AtomicI32) { } #[cfg(target_os = "emscripten")] -pub fn futex_wake(futex: &AtomicI32) { +pub fn futex_wake(futex: &AtomicI32) -> bool { extern "C" { fn emscripten_futex_wake(addr: *const AtomicI32, count: libc::c_int) -> libc::c_int; } - unsafe { - emscripten_futex_wake(futex as *const AtomicI32, 1); - } + unsafe { emscripten_futex_wake(futex as *const AtomicI32, 1) > 0 } } | 
