Skip to main content

WordWait

Struct WordWait 

Source
pub struct WordWait { /* private fields */ }
Available on AArch64 and Linux and crate feature wordwait only.
Expand description

This core’s word-wait capabilities, read once. A value is proof that the core has the instructions WordWait::park executes, so the only way to get one is WordWait::probe; it cannot be written by hand (in 0.1.0 the fields were public, and a forged timed: true ran wfet on a core without FEAT_WFxT: SIGILL).

ⓘ
use gpu_async_reactor::backend::wordwait::WordWait;
let forged = WordWait { timed: true, counter_hz: 24_000_000 };
use gpu_async_reactor::backend::wordwait::WordWait;
let w = WordWait::probe().expect("every aarch64 Linux core has ldxr + wfe");
assert!(w.counter_hz() > 0);
let _: bool = w.timed();

Implementations§

Source§

impl WordWait

Source

pub fn timed(&self) -> bool

FEAT_WFxT present: a park is bounded by its own deadline (else by the kernel’s event stream).

Source

pub fn counter_hz(&self) -> u64

The generic timer’s frequency (cntfrq_el0), Hz.

Source§

impl WordWait

Source

pub fn probe() -> Result<Self, &'static str>

This CPU’s word wait, or why there is none. Probe once and keep the value.

§Errors

The CPU or target lacks a user-mode monitor/wait.

Source

pub fn park( &self, line: &CompletionLine, ready: impl Fn(&CompletionLine) -> bool, bound: Duration, ) -> bool

Park on line until ready(line) holds, a store to the line wakes the core, or bound passes; returns ready(line). Any store to the line wakes the park, so one waiter can watch every slot; a single-word wait is ready = |l| l.words[slot].load(Acquire) == expect. May return false early.

Trait Implementations§

Source§

impl Clone for WordWait

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for WordWait

Source§

impl Debug for WordWait

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for WordWait

Source§

impl PartialEq for WordWait

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WordWait

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.