pthread_cond_init Subroutine



Purpose

Initializes a condition variable and sets its attributes.

Library

Threads Library (libpthreads.a)

Syntax

#include 

int pthread_cond_init (condition, attr)
pthread_cond_t *condition;
pthread_condattr_t *attr;

Description

The pthread_cond_init subroutine initializes a new condition variable
condition, and sets its attributes according the condition attributes
object attr.

After initialization of the condition variable, the condition attributes
object can be reused for another condition variable initialization,
or deleted.

Note:	The pthread.h header file must be the first included file of
each source file using the threads library.

Parameters

condition	Specifies the condition to be created.

attr	Specifies the condition attributes object to use for initializing
the condition variable. If the value is NULL, the default attributes
values are used.

Return Values

Upon successful completion, the new condition variable is returned
via the condition parameter, and 0 is returned. Otherwise, an error
code is returned.

Error Codes

The pthread_cond_init subroutine is unsuccessful if the following
is true:

EBUSY	The condition condition is already in use: it was previously
created with by calling the pthread_cond_init subroutine, and not
destroyed by calling the pthread_cond_destroy subroutine.

EINVAL	The condition or attr parameters are not valid.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

Related Information

The pthread_condattr_init subroutine, pthread_condattr_destroy subroutine,
pthread_cond_wait or pthread_cond_timedwait subroutine, pthread_cond_destroy
subroutine, PTHREAD_COND_INITIALIZER macro.

Using Condition Variables and Threads Library Quick Reference.