pthread_cond_init()

initialize condition variable 

Function


SYNOPSIS

#include <pthread.h>

int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);


DESCRIPTION

The pthread_cond_init() function initializes the specified condition variable. If attr is non-NULL, the attributes specified are used to initialize the condition variable. If the attribute object is modified later, the condition variable's attributes are not affected. If attr is NULL, the condition variable is initialized with default attributes, as specified for pthread_condattr_init().

A condition variable can be statically initialized by assigning PTHREAD_COND_INITIALIZER in its definition, as follows:

pthread_cond_t def_cond = PTHREAD_COND_INITIALIZER;

A condition variable must be initialized (either by calling pthread_cond_init(), or statically) before it may be used in any other condition variable functions.


PARAMETERS

cond 

Is the condition variable to initialize.

attr 

Specifies the attributes used for initializing the condition variable, or NULL if default attributes should be used.


RETURN VALUES

On success, pthread_cond_init() returns 0. On error, one of the following values is returned:

EAGAIN 

System resources (other than memory) are unavailable.

EINVAL 

attr does not refer to a valid condition variable attribute object.

ENOMEM 

Insufficient memory exists to initialize the condition variable.

EFAULT 

cond or attr is an invalid pointer.


CONFORMANCE

POSIX P1003.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_cond_destroy(), pthread_condattr_init()


PTC MKS Toolkit 10.4 Documentation Build 39.