Skip to main content

Module task

Module task 

Source
Expand description

This service’s own execution: giving up the CPU, waiting, and what time it is.

§Waiting is not the same as sleeping

The functions here wait on the CLOCK, and that makes them the wrong tool for waiting on another service. Commandment VIII: wait on the truth, not on time. If you are sleeping because a peer might not be ready yet, you have written a race that passes on your machine - wait for the thing itself (crate::ipc::recv_within, a reply, an interrupt), and let it tell you.

What a sleep IS for: pacing something that has no event to wait on. A poll of an external device, a retry after congestion, a display that should not repaint faster than anyone can read.

Structs§

Datetime
Wall-clock date/time read from the hardware RTC, fully decoded (binary, 24-hour). See ServiceContext::datetime.

Enums§

ClockSource
Where a wall-clock reading came from. Reported alongside the time so a displayed timestamp says what it is standing on: a local hardware clock, a network correction, or nothing (§26.4 - a fallback chain is mechanism while its choice is visible, and magic when it is not).

Constants§

AUTHORITIES
The kernel’s fixed authorities: (resource id, contract name, what it allows) - for naming a capability. THE KERNEL’S FIXED AUTHORITIES, by resource id: (id, the name a contract uses, what it lets a task do).

Functions§

clock_is_set
Whether the time service’s clock is worth showing as a date at all.
clock_source
Where the wall clock came from, so a displayed timestamp can say what it stands on.
core_id
Which core this service is running on.
datetime
The HARDWARE real-time clock as calendar fields (InspectKernel query 11), with Datetime::epoch_secs to turn it into epoch seconds.
epoch_secs_monotonic
Seconds that never go backwards (InspectKernel query 17).
hw_random
A random 32-bit word from the hardware (InspectKernel query 19), or None on a machine whose port exposes no hardware random source. Ungated: entropy confers no authority.
sleep_ms
Sleep for ms milliseconds.
sleep_quantum
Sleep for one scheduler quantum, parked: the shortest sleep there is.
sleep_ticks
Sleep for ticks of the counter crate::driver::wait::ticks reads.
sleep_us
Sleep for us microseconds, at the kernel’s resolution.
uptime_secs
Seconds since this machine booted.
wall_clock
The time service’s clock: epoch seconds, and where they came from (clock_source explains the four answers). None when there is no clock or time did not answer, which oblige a caller to the same thing: not to treat any number as the date.
yield_now
Give up the rest of this quantum.