cond_init initializes the condition variable
pointed to by cond to be of type type.
Once created, the condition cond can be used any number of
times without being re-initialized.
Parameters
cond
pointer to condition variable to be initialized
type
USYNC_THREAD or USYNC_PROCESS
arg
NULL (reserved for future use)
cond parameter
cond points to the condition variable to be initialized.
type parameter
type can be set to one of the following values:
USYNC_THREAD
initialize the condition variable for threads within the current process
USYNC_PROCESS
initialize the condition variable for threads across processes
arg parameter
arg should be set to NULL.
It is not currently used, but is reserved for future use.
Static condition variable initialization
In this implementation, a condition variable can be initialized statically
if its storage is zero-filled.
In this case, the condition variable is of typeUSYNC_THREAD,
and cond_init need not be called.
Return values
cond_init returns zero for success
and an error number for failure.
Errors
If the following condition is detected,
cond_init returns the corresponding value:
EINVAL
invalid type or NULLcond argument specified
Warnings
cond_init does not examine the cond argument
before initializing it.
If cond_init is called more than once for the same condition,
it will overwrite its state.
It is the user's responsibility to ensure that cond_init
is only called once for each condition variable.