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.

RELATED INFORMATION

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

Data Structures: tvalspec.