Alarm
An alarm on a clock.
class Alarm
An alarm is just a port which the kernel will send a message to at the specified time.
Normally, the kernel will be the only task sending a message to an alarm. However, the mechanism it uses to do so is exposed in user space. To simulate an alarm reply from the kernel, use the reply(returning:time:type:)
function.
Allocating Alarm Ports
static func allocate(name: mach_port_name_t?, onClock: Mach.Clock, after: Mach.Clock.Duration
) throws -> Self Sets an alarm to ring after a given duration.
static func allocate(name: mach_port_name_t?, onClock: Mach.Clock, at: Mach.Clock.Instant
) throws -> Self Sets an alarm to ring at a given time.
struct TimeType
A type of time value.
static func allocate(name: mach_port_name_t?, onClock: Mach.Clock, time: mach_timespec_t, type: Mach.TimeType
) throws -> Self Sets up an alarm on a given clock.
Simulating a Reply
func reply(returning: MachError.Code, time: mach_timespec_t, type: Mach.TimeType
) throws Sends a reply to the alarm.