cnd_init()

Updated: May 06, 2022

Initialize a condition variable

Synopsis:

#include <threads.h>

int cnd_init(cnd_t *cond );

Arguments:

cond
A pointer to the cnd_t object that you want to initialize.
Note: It's always safe, and typically faster, to assure that cond is 32-bit aligned.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The cnd_init() function initializes the condition variable cond.

CAUTION:
You should allocate synchronization objects only in normal memory mappings. On certain processors, atomic operations such as calls to mtx_lock() will cause a fault if the control structure is allocated in uncached memory.

Returns:

thrd_nomem
All kernel synchronization objects are in use, or there wasn't enough memory to initialize the condvar.
thrd_success
Success.
thrd_error
An error occurred.

Classification:

C11

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes