Multithreaded Programming Guide

cond_init(3T)

#include <thread.h>

int cond_init(cond_t *cv, int type, int arg);

Use cond_init() to initialize the condition variable pointed to by cv. The type can be one of the following (note that arg is currently 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 it.

Condition Variables with Intraprocess Scope

#include <thread.h>

cond_t cv;
int ret;

/* to be used within this process only */
ret = cond_init(cv, USYNC_THREAD, 0); 

Condition Variables with Interprocess Scope

#include <thread.h>

cond_t cv;
int ret;

/* to be used among all processes */
ret = cond_init(&cv, USYNC_PROCESS, 0);