Trait HrTimerPointer

Source
pub trait HrTimerPointer: Sync + Sized {
    type TimerHandle: HrTimerHandle;

    // Required method
    fn start(self, expires: Ktime) -> Self::TimerHandle;
}
Expand description

Implemented by pointer types that point to structs that contain a HrTimer.

Self must be Sync because it is passed to timer callbacks in another thread of execution (hard or soft interrupt context).

Starting a timer returns a HrTimerHandle that can be used to manipulate the timer. Note that it is OK to call the start function repeatedly, and that more than one HrTimerHandle associated with a HrTimerPointer may exist. A timer can be manipulated through any of the handles, and a handle may represent a cancelled timer.

Required Associated Types§

Source

type TimerHandle: HrTimerHandle

A handle representing a started or restarted timer.

If the timer is running or if the timer callback is executing when the handle is dropped, the drop method of HrTimerHandle should not return until the timer is stopped and the callback has completed.

Note: When implementing this trait, consider that it is not unsafe to leak the handle.

Required Methods§

Source

fn start(self, expires: Ktime) -> Self::TimerHandle

Start the timer with expiry after expires time units. If the timer was already running, it is restarted with the new expiry time.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, A> HrTimerPointer for Pin<Box<T, A>>
where T: 'static + Send + Sync + HasHrTimer<T> + for<'a> HrTimerCallback<Pointer<'a> = Pin<Box<T, A>>>, A: Allocator,

Source§

type TimerHandle = BoxHrTimerHandle<T, A>

Source§

fn start(self, expires: Ktime) -> Self::TimerHandle

Implementors§

Source§

impl<T> HrTimerPointer for Arc<T>
where T: 'static + Send + Sync + HasHrTimer<T> + for<'a> HrTimerCallback<Pointer<'a> = Self>,