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§
sourcefn deadline(&self, waker: Waker, deadline: Instant) -> Result<Option<Handle>>
fn deadline(&self, waker: Waker, deadline: Instant) -> Result<Option<Handle>>
Create new deadline
timer, returns None
if the deadline
instant is reached.
sourcefn timeout_wait(&self, waker: Waker, handle: &Handle) -> Poll<()>
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.