The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


pthread_condattr_init, pthread_condattr_destroy - initialise and destroy condition variable attributes object


#include <pthread.h>

int pthread_condattr_init(pthread_condattr_t *attr);
int pthread_condattr_destroy(pthread_condattr_t *attr);


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. An implementation may cause pthread_condattr_destroy() to 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.

Additional attributes, their default values, and the names of the associated functions to get and set those attribute values are implementation-dependent.


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


The pthread_condattr_init() function will fail if:
Insufficient memory exists to initialise the condition variable attributes object.

The pthread_condattr_destroy() function may fail if:

The value specified by attr is invalid.

These functions will not return an error code of [EINTR].








pthread_condattr_getpshared(), pthread_create(), pthread_mutex_init(), pthread_cond_init(), <pthread.h>.


Derived from the POSIX Threads Extension (1003.1c-1995)

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]