POSIX Threads for Windows – REFERENCE - Pthreads-w32

Reference Index

Table of Contents


pthread_condattr_init, pthread_condattr_destroy - condition creation



#include <pthread.h>

int pthread_condattr_init(pthread_condattr_t *attr);

int pthread_condattr_destroy(pthread_condattr_t *attr);


Condition attributes can be specified at condition creation time, by passing a condition attribute object as second argument to pthread_cond_init(3) . Passing NULL is equivalent to passing a condition attribute object with all attributes set to their default values.

pthread_condattr_init initializes the condition attribute object attr and fills it with default values for the attributes. pthread_condattr_destroy destroys a condition attribute object, which must not be reused until it is reinitialized.

Pthreads-w32 defines _POSIX_THREAD_PROCESS_SHARED in pthread.h as -1 to indicate that the attribute routines are implemented but that the process shared attribute is not supported.

Return Value

All condition variable functions return 0 on success and a non-zero error code on error.


The pthread_condattr_init function returns the following error code on error:

The was insufficient memory to create the attribute.

The pthread_condattr_destroy function returns the following error code on error:

The attr argument is not valid.


Xavier Leroy <Xavier.Leroy@inria.fr>

Modified by Ross Johnson for use with Pthreads-w32.

See Also

pthread_cond_init(3) .

Table of Contents