[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1

pthread_condattr_destroy or pthread_condattr_init Subroutine

Purpose

Initialises and destroys condition variable.

Library

Threads Library (libpthreads.a)

Syntax

#include <pthread.h>
int pthread_condattr_destroy (pthread_condattr_t *attr);
int pthread_condattr_init (pthread_condattr_t *attr);

Description

The function pthread_condattr_init initialises a condition variable attributes object attr with the default value for all of the attributes defined by the implementation. Attempting to initialise an already initialised condition variable attributes object results in undefined behaviour.

After a condition variable attributes object has been used to initialise one or more condition variables, any function affecting the attributes object (including destruction) does not affect any previously initialised condition variables.

The pthread_condattr_destroy function destroys a condition variable attributes object; the object becomes, in effect, uninitialised. The pthread_condattr_destroy subroutine may set the object referenced by attr to an invalid value. A destroyed condition variable attributes object can be re-initialised using pthread_condattr_init; the results of otherwise referencing the object after it has been destroyed are undefined.

Parameter

attr Specifes the condition attributes object to delete.

Return Values

If successful, the pthread_condattr_init and pthread_condattr_destroy functions return zero. Otherwise, an error number is returned to indicate the error.

Error Code

The pthread_condattr_init function will fail if:

ENOMEM Insufficient memory exists to initialise the condition variable attributes object.

The pthread_condattr_destroy function may fail if:

EINVAL The value specified by attr is invalid.

These functions will not return an error code of EINTR.

Implementation Specifics

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

Related Information

The pthread_cond_init subroutine, the pthread_condattr_getpshared, the pthread_create, the pthread_mutex_init, the pthread.h file.

Using Condition Variables in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

Threads Library Quick Reference in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]