Crate sleep

source ·
Expand description

Provides APIs for tasks to sleep for specified time durations.

Key functions:

  • The sleep function delays the current task for a given number of ticks.
  • The sleep_until function delays the current task until a specific moment in the future.
  • The [sleep_periodic] function allows for tasks to be delayed for periodic intervals of time and can be used to implement a period task.

TODO: use regular time-keeping abstractions like Duration and Instant.

Modules

Asynchronous sleep methods that operate on wakers.

Structs

A Duration type to represent a span of time, typically used for system timeouts.

Functions

Blocks the current task by putting it to sleep for duration ticks.
Blocks the current task by putting it to sleep until a specific tick count is reached, given by resume_time.
Remove all tasks that have been delayed but are able to be unblocked now, the current tick count is provided by the system’s interrupt tick count.