The pthread_barrierattr_init(3C) function initializes a barrier attributes object attr with the default values for the attributes defined for the object by the implementation. Currently, only the process-shared attribute is provided, and the pthread_barrierattr_getpshared() and pthread_barrierattr_setpshared() functions are used to get and set the attribute.
After a barrier attributes object has been used to initialize one or more barriers, any function affecting the attributes object (including destruction) does not affect any previously initialized barrier.
int pthread_barrierattr_init(pthread_barrierattr_t *attr);
#include <pthread.h> pthread_barrierattr_t attr; int ret; ret = pthread_barrierattr_init(&attr);
pthread_barrierattr_init() returns zero after completing successfully. Any other return value indicates that an error occurred. If the following condition occurs, the function fails and returns the corresponding value.
Insufficient memory exists to initialize the barrier attributes object.