Adelsbach Enhanced Threading Library

Manual Pages (DD-00013-001)

Enhanced Threading Library > thrd_sleep (3)
HTML TXT PDF PS
thrd_sleep(3) Library Functions Manual thrd_sleep(3)

thrd_sleephigh-resolution thread sleep

library “threads”
#include <threads.h>

int
thrd_sleep(const struct timespec *ts);

The function () will suspend the execution of the current thread for a specified time interval ts. The time interval specified by ts might be rounded up, depending upon the system time resolution, as such a thread may sleep longer than requested.

The thread may be woken up by a signal regardless of the interval specified.

The function thrd_sleep() will return 0 if the thread has been sleeping for at least the requested time. If an error occurs -1 will be returned, errno may be set but this cannot be relied upon, as it is not part of the standard behavior.

thrd_create(3) thrd_exit(3) thrd_yield(3) thrd_equal(3) thrd_detach(3) thrd_current(3) thrd_join(3)

The thrd_sleep() function first appeared in the C11 standard ISO/IEC 9899:2011.

Jan Adelsbach <jan@jadelsbach.de>

May 9, 2020 Debian