DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

cond_init(SYNCH)


cond_init -- initialize a condition variable

Synopsis

   cc [options] -Kthread file
   

#include <synch.h>

int cond_init(cond_t *cond, int type, void *arg);

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.

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 type USYNC_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 NULL cond 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.

References

Intro(SYNCH), condition(SYNCH), cond_broadcast(SYNCH), cond_destroy(SYNCH), cond_signal(SYNCH), cond_timedwait(SYNCH), cond_wait(SYNCH)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005