[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


pthread_condattr_destroy or pthread_condattr_init Subroutine

Purpose

Initializes 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 initializes a condition variable attributes object attr with the default value for all of the attributes defined by the implementation. Attempting to initialize an already initialized condition variable attributes object results in undefined behavior.

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

The pthread_condattr_destroy function destroys a condition variable attributes object; the object becomes, in effect, uninitialized. 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-initialized using pthread_condattr_init; the results of otherwise referencing the object after it has been destroyed are undefined.

Parameter


attr Specifies 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 initialize 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 (pthread_cond_destroy or pthread_cond_init Subroutine) subroutine, pthread_condattr_getpshared (pthread_condattr_getpshared Subroutine) subroutine, pthread_create (pthread_create Subroutine) subroutine, pthread_mutex_init (pthread_mutex_init or pthread_mutex_destroy Subroutine) subroutine.

The pthread.h file.

Using Condition Variables in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.

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


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]