Rollup merge of #108507 - hermitcore:new, r=m-ou-se

use `as_ptr` to determine the address of atomics

The PR #107736 renamed  atomic `as_mut_ptr` to `as_ptr`. Consequently, the futex implementation of the tier-3 platform `RutyHermit` has to use this new interface. In addition, this PR removes also an unused import.
This commit is contained in:
Matthias Krüger 2023-03-13 21:55:35 +01:00 committed by GitHub
commit 96f4497f46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -16,7 +16,7 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -
let r = unsafe { let r = unsafe {
abi::futex_wait( abi::futex_wait(
futex.as_mut_ptr(), futex.as_ptr(),
expected, expected,
timespec.as_ref().map_or(null(), |t| t as *const abi::timespec), timespec.as_ref().map_or(null(), |t| t as *const abi::timespec),
abi::FUTEX_RELATIVE_TIMEOUT, abi::FUTEX_RELATIVE_TIMEOUT,
@ -28,12 +28,12 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -
#[inline] #[inline]
pub fn futex_wake(futex: &AtomicU32) -> bool { 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] #[inline]
pub fn futex_wake_all(futex: &AtomicU32) { pub fn futex_wake_all(futex: &AtomicU32) {
unsafe { unsafe {
abi::futex_wake(futex.as_mut_ptr(), i32::MAX); abi::futex_wake(futex.as_ptr(), i32::MAX);
} }
} }

View File

@ -15,7 +15,6 @@
#![allow(missing_docs, nonstandard_style, unsafe_op_in_unsafe_fn)] #![allow(missing_docs, nonstandard_style, unsafe_op_in_unsafe_fn)]
use crate::intrinsics;
use crate::os::raw::c_char; use crate::os::raw::c_char;
pub mod alloc; pub mod alloc;