Trait rasi_syscall::Timer

source ·
pub trait Timer: Send + Sync {
    // Required methods
    fn deadline(
        &self,
        waker: Waker,
        deadline: Instant
    ) -> Result<Option<Handle>>;
    fn timeout_wait(&self, waker: Waker, handle: &Handle) -> Poll<()>;
}
Available on crate feature time only.
Expand description

Timer-related system call interface

Required Methods§

source

fn deadline(&self, waker: Waker, deadline: Instant) -> Result<Option<Handle>>

Create new deadline timer, returns None if the deadline instant is reached.

source

fn timeout_wait(&self, waker: Waker, handle: &Handle) -> Poll<()>

Wait timeout event.

Returns Poll::Ready(()) if the timer already reached the deadline, otherwise returns Poll::Pending and needs to be retried later.

We don’t need to return CancelablePoll, because the implementation should stop the timer when the timer handler drops.

Implementors§