diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2022-04-29 16:44:28 +0200 | 
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2022-04-29 16:45:17 +0200 | 
| commit | c4c69143a996a9065a040e7d99c31da7b1ad7a81 (patch) | |
| tree | a76090727fc4f1a8289a63a99c57142a8c3d71d8 /library/std/src/sys/unix/futex.rs | |
| parent | 0b4df22f550417d55b32632ccee86a67aca63868 (diff) | |
| download | rust-c4c69143a996a9065a040e7d99c31da7b1ad7a81.tar.gz rust-c4c69143a996a9065a040e7d99c31da7b1ad7a81.zip | |
Always return false in futex_wake on {Free,DragonFly}BSD.
Diffstat (limited to 'library/std/src/sys/unix/futex.rs')
| -rw-r--r-- | library/std/src/sys/unix/futex.rs | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/library/std/src/sys/unix/futex.rs b/library/std/src/sys/unix/futex.rs index 4f91d48f2f0..fd046bdf19d 100644 --- a/library/std/src/sys/unix/futex.rs +++ b/library/std/src/sys/unix/futex.rs @@ -104,6 +104,8 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) - /// /// Returns true if this actually woke up such a thread, /// or false if no thread was waiting on this futex. +/// +/// On some platforms, this always returns false. #[cfg(any(target_os = "linux", target_os = "android", target_os = "netbsd"))] pub fn futex_wake(futex: &AtomicU32) -> bool { let ptr = futex as *const AtomicU32; @@ -135,9 +137,9 @@ pub fn futex_wake_all(futex: &AtomicU32) { } } -// FreeBSD doesn't tell us how many threads are woken up, so this doesn't return a bool. +// FreeBSD doesn't tell us how many threads are woken up, so this always returns false. #[cfg(target_os = "freebsd")] -pub fn futex_wake(futex: &AtomicU32) { +pub fn futex_wake(futex: &AtomicU32) -> bool { use crate::ptr::null_mut; unsafe { libc::_umtx_op( @@ -148,6 +150,7 @@ pub fn futex_wake(futex: &AtomicU32) { null_mut(), ) }; + false } #[cfg(target_os = "freebsd")] @@ -231,10 +234,11 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) - r == 0 || super::os::errno() != libc::ETIMEDOUT } -// DragonflyBSD doesn't tell us how many threads are woken up, so this doesn't return a bool. +// DragonflyBSD doesn't tell us how many threads are woken up, so this always returns false. #[cfg(target_os = "dragonfly")] -pub fn futex_wake(futex: &AtomicU32) { +pub fn futex_wake(futex: &AtomicU32) -> bool { unsafe { libc::umtx_wakeup(futex as *const AtomicU32 as *const i32, 1) }; + false } #[cfg(target_os = "dragonfly")] | 
