cond_init(3synch) cond_init(3synch)
NAME
cond_init - initialize a condition variable
SYNOPSIS
cc [options] -Kthread file
#include <synch.h>
int cond_init(cond_t *cond, int type, void *arg);
Parameters
cond pointer to condition variable to be initialized
type USYNC_THREAD or USYNC_PROCESS
arg NULL (reserved for future use)
DESCRIPTION
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.
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 type USYNC_THREAD, and
cond_init need not be called.
Return Values
cond_init returns zero for success and an error number for
failure, as described below.
Copyright 1994 Novell, Inc. Page 1
cond_init(3synch) cond_init(3synch)
Errors
If any of the following conditions is detected, cond_init
returns the corresponding value:
EINVAL Invalid type or NULL cond argument specified.
USAGE
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.
REFERENCES
condition(3synch), cond_broadcast(3synch),
cond_destroy(3synch), cond_signal(3synch),
cond_timedwait(3synch), cond_wait(3synch), synch(3synch)
Copyright 1994 Novell, Inc. Page 2