pthread_condattr_init(3pthread)


pthread_condattr_init, pthread_condattr_destroy -- initialise and destroy condition variable attributes object

Synopsis

cc [options] -Kthread file

#include <pthread.h>

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

Description

pthread_condattr_init initialises a condition variable attributes object attr with the default values for all of the attributes defined by the implementation.

Attempting to initialize 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.

pthread_condattr_destroy destroys a condition variable attributes object; the object becomes, in effect, uninitialised. 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.

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.

Diagnostics

If the following condition is detected, pthread_condattr_init returns the corresponding value:

ENOMEM
insufficient memory to initialise the condition variable attributes object.

If the following condition is detected, pthread_condattr_destroy will return the corresponding value:


EINVAL
attr is invalid.

References

pthread_condattr_getpshared(3pthread), pthread_create(3pthread), pthread_cond_init(3pthread), pthread(4)

Standards compliance

The Single UNIX Specification, Version 2; The Open Group.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004