< c‎ | thread
Revision as of 15:00, 2 November 2012 by P12bot (Talk | contribs)

Defined in header <threads.h>
int thrd_sleep( const struct timespec* time_point,
                struct timespec* remaining );
(since C11)

Blocks the execution of the current thread for at least until the TIME_UTC based time point pointed to by time_point has been reached.

The sleep may resume earlier if a signal that is not ignored is received. In such case, if remaining is not NULL, the remaining time duration is stored into the object pointed to by remaining.


time_point - pointer to the time point to sleep until
remaining - pointer to the object to put the remaining time on interruption. May be NULL, in which case it is ignored

Return value

0 on successful sleep, -1 if an interrupt occurred, other negative value if an error occurred.

See also

Template:c/thread/dcl list thrd yield