##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# thread_sleep

From cppreference.com
< c‎ | thread

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`.

### [edit] Parameters

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

### [edit] Return value

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

### [edit] See also

thrd_yield (C11) | yields the current time slice (function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/thread/thrd_sleep&oldid=63559"