Use cond_init(3C) to initialize the condition variable pointed to by cv.
#include <thread.h> int cond_init(cond_t *cv, int type, int arg);
The type can be one of the following values:
USYNC_PROCESS. The condition variable can be used to synchronize threads in this process and other processes. arg is ignored.
USYNC_THREAD The condition variable can be used to synchronize threads in this process only. arg is ignored.
Condition variables can also be initialized by allocation in zeroed memory, in which case a type of USYNC_THREAD is assumed.
Multiple threads must not initialize the same condition variable simultaneously. A condition variable must not be reinitialized while other threads might be using the condition variable.
For POSIX threads, see pthread_condattr_init Syntax .
#include <thread.h> cond_t cv; int ret; /* to be used within this process only */ ret = cond_init(cv, USYNC_THREAD, 0);
#include <thread.h> cond_t cv; int ret; /* to be used among all processes */ ret = cond_init(&cv, USYNC_PROCESS, 0);
cond_init() returns 0 if successful. When any of the following conditions is detected, cond_init() fails and returns the corresponding value.
EFAULT
Description: cv points to an illegal address.
EINVAL
Description: type is not a recognized type.