Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Thursday, June 13, 2019
 
 

cnd_timedwait(3C)

Name

cnd_init, cnd_wait, cnd_timedwait, cnd_signal, cnd_broadcast, cnd_destroy - C11 condition variable functions

Synopsis

#include <threads.h>
int cnd_init(cnd_t *cond);
int cnd_wait(cnd_t *cond, mtx_t *mtx);
int cnd_timedwait(cnd_t *restrict cond, mtx_t *restrict mtx,
          const struct timespec *restrict ts);
int cnd_signal(cnd_t *cond);
int cnd_broadcast(cnd_t *cond);
void cnd_destroy(cnd_t *cond);

Description

The cnd_init(), cnd_wait(), cnd_timedwait(), cnd_signal(), cnd_broadcast(), and cnd_destroy() functions are part of the threads interfaces as specified in the C11 standard. They are simple wrappers over the more general pthreads functions. See INCITS/ISO/IEC 9899:2011.

C11 Threads
POSIX Threads
cnd_init()
pthread_cond_init()
cnd_wait()
pthread_cond_wait()
cnd_timedwait()
pthread_cond_timedwait()
cnd_signal()
pthread_cond_signal()
cnd_broadcast()
pthread_cond_broadcast()
cnd_destroy()
pthread_cond_destory()

Return Values

Upon successful completion, each of the cnd_init(), cnd_wait(), cnd_timedwait(), cnd_signal(), and cnd_broadcast() functions return thrd_success. If allocation of memory fails for the newly created condition, cnd_init() returns thrd_nomem. If the requested resource is not aquired in the time specified by ts to cnd_timedwait(), cnd_timedwait() returns thrd_timedout. If the request could not otherwise be honored by any of these functions, thrd_error is returned.

No value is returned by the cnd_destroy() function.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe

See Also

pthread_cond_broadcast(3C), pthread_cond_destroy(3C), pthread_cond_init(3C), pthread_cond_signal(3C), pthread_cond_timedwait(3C), pthread_cond_wait(3C), threads.h(3HEAD), attributes(7), condition(7), mutex(7)