cnd_timedwait(3) | Library Functions Manual | cnd_timedwait(3) |
NAME
cnd_timedwait
—
wait for a condition with timeout
SYNOPSIS
library “threads”
#include <threads.h>
int
cnd_timedwait
(cnd_t
*cnd, mtx_t mtx,
const struct timespec
*ts);
DESCRIPTION
The function
cnd_timedwait
()
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
cnd_timedwait
()
may be woken up by signals.
RETURN VALUES
Upon success cnd_timedwait
() returns
thrd_success, if a timeout occurred
thrd_timedout will be returned. On an error
thrd_error will be returned.
SEE ALSO
cnd_init(3) cnd_destroy(3) cnd_broadcast(3) cnd_timedwait(3) cnd_wait(3) mtx_init(3)
HISTORY
The cnd_timedwait
() function first
appeared in the C11 standard ISO/IEC 9899:2011.
AUTHORS
Jan Adelsbach <jan@jadelsbach.de>
May 9, 2020 | Debian |