Skip to content

Commit

Permalink
use as_ptr to determine the address of atomics
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Feb 27, 2023
1 parent daf31a1 commit ae27762
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/std/src/sys/hermit/futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -

let r = unsafe {
abi::futex_wait(
futex.as_mut_ptr(),
futex.as_ptr(),
expected,
timespec.as_ref().map_or(null(), |t| t as *const abi::timespec),
abi::FUTEX_RELATIVE_TIMEOUT,
Expand All @@ -28,12 +28,12 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -

#[inline]
pub fn futex_wake(futex: &AtomicU32) -> bool {
unsafe { abi::futex_wake(futex.as_mut_ptr(), 1) > 0 }
unsafe { abi::futex_wake(futex.as_ptr(), 1) > 0 }
}

#[inline]
pub fn futex_wake_all(futex: &AtomicU32) {
unsafe {
abi::futex_wake(futex.as_mut_ptr(), i32::MAX);
abi::futex_wake(futex.as_ptr(), i32::MAX);
}
}

0 comments on commit ae27762

Please sign in to comment.