Back to Darwin Xnu

Clock Sleep

osfmk/man/clock_sleep.html

latest1.7 KB
Original Source

clock_sleep


System Trap - Sleep until a given time.

SYNOPSIS

**kern\_return\_t clock\_sleep**** (mach\_port\_t **clock\_name,** sleep\_type\_t **sleep\_type,** tvalspec\_t **sleep\_time,** clock\_name **wake\_time** );**

PARAMETERS

clock_name[in clock-name send right] The name (or control) port for the clock.

sleep_type[in scalar] How to interpret the sleep_time value:

TIME_RELATIVE Interpret the sleep time as relative to the current time.

TIME_ABSOLUTE Interpret the sleep time as an absolute time.

sleep_time[in structure] The time when the sleep is to terminate.

wake_time[out structure] The actual (absolute) time at which the sleep terminated.

DESCRIPTION

The clock_sleep system trap delays the invoking thread until a specified time. This sleep may be aborted by thread_abort. Not all clocks provide this service but the REALTIME clock must.

If the specified time is in the past, the call returns immediately with the wake time being the current time. If the clock's time is changed ( clock_set_time ), the sleep will be interrupted. The thread will waken at the service time nearest the specified sleep time as governed by the current clock alarm resolution.

RETURN VALUES

KERN_FAILURE The clock does not support a sleep service.

KERN_ABORTED The sleep was interrupted by thread_abort or terminated via use of clock_set_time.

Functions: host_get_clock_service, clock_get_attributes, clock_get_time, clock_alarm, clock_set_time, thread_abort,

Data Structures: tvalspec.