pthread_barrierattr_destroy or pthread_barrierattr_init Subroutine

Purpose

Destroys or initializes the barrier attributes object.

Syntax

#include <pthread.h>

int pthread_barrierattr_destroy(pthread_barrierattr_t *attr);
int pthread_barrierattr_init(pthread_barrierattr_t *attr); 

Description

The pthread_barrierattr_destroy subroutine destroys a barrier attributes object. A destroyed attr attributes object can be reinitialized using the pthread_barrierattr_init subroutine; the results of otherwise referencing the object after it has been destroyed are undefined. An implementation can cause the pthread_barrierattr_destroy subroutine to set the object referenced by the attr parameter to an invalid value.

The pthread_barrierattr_init subroutine initializes a barrier attributes object attr with the default value for all of the attributes defined by the implementation.

Results are undefined if the pthread_barrierattr_init subroutine is called specifying an already initialized attr attributes object.

After a barrier attributes object has been used to initialize one or more barriers, any function affecting the attributes object (including destruction) do not affect any previously initialized barrier.

Return Values

If successful, the pthread_barrierattr_destroy and pthread_barrierattr_init subroutines return zero; otherwise, an error number shall be returned to indicate the error.

Error Codes

The pthread_barrierattr_destroy subroutine can fail if:
Item Description
EINVAL The value specified by the attr parameter is invalid.
The pthread_barrierattr_init subroutine will fail if:
Item Description
ENOMEM Insufficient memory exists to initialize the barrier attributes object.