CLOCK_NANOSLEEPSection: Linux Programmer's Guide (2)
Index Return to Main Contents
NAMEclock_nanosleep - Suspend execution of the currently running thread
- long sys_clock_nanosleep (clockid_t which_clock, int flags, const struct timespec *rqtp, struct timespec *rmtp);
clock_nanosleep suspends execution of the currently running thread until the time interval specified by rqtp is elapsed, or until the function is woken up by a signal. The rmtp is updated with the amount of time remaining in the time interval (requested minus sleep time) if non-null. If null, the rmtp argument does not return any remaining time information.
The flags parameter specifies the type of behavior the call will take. So far, the only value defined for this parameter (defined in include/linux.time.h is TIMER_ABSTIME). This value causes the current thread to be suspended from execution in three ways:
- Until either the time value of the clock specified by clock_id reaches the absolute time specified by the rqtp argument.
- Until a signal is delivered to the calling thread and its action is to invoke a signal-catching function.
- Until the process is terminated.
The values that clockid_t currently supports for POSIX.1b timers (defined in include/linux/time.h) are:
- Systemwide realtime clock.
- Represents monotonic time. Cannot be set.
- High resolution per-process timer.
- Thread-specific timer.
- An invalid which_clock value or an invalid rqtp was specified.
- The value was could not be copied to the rmtp or an invalid rqtp value was specified.
This document was created by man2html, using the manual pages.
Time: 05:33:03 GMT, December 24, 2015