Adelsbach Enhanced Threading Library

Manual Pages (DD-00013-001)

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

cnd_timedwaitwait for a condition with timeout

library “threads”
#include <threads.h>

int
cnd_timedwait(cnd_t *cnd, mtx_t mtx, const struct timespec *ts);

The function () will stall the calling thread until a condition is being send to cnd from an other thread using either of cnd_signal(3) or cnd_broadcast(3) for up to a given absolute time specified by ts (based on CLOCK_REALTIME) after which it will give up and continue execution. The function will release the mutex mtx atomically and hold it once the thread resumes execution.

A thread waiting with () may be woken up by signals.

Upon success cnd_timedwait() returns thrd_success, if a timeout occurred thrd_timedout will be returned. On an error thrd_error will be returned.

cnd_init(3) cnd_destroy(3) cnd_broadcast(3) cnd_timedwait(3) cnd_wait(3) mtx_init(3)

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

Jan Adelsbach <jan@jadelsbach.de>

May 9, 2020 Debian