PTHREAD_BARRIERATTR_INIT(3) | Library Functions Manual | PTHREAD_BARRIERATTR_INIT(3)

# NAME

`pthread_barrierattr_init`, `pthread_barrierattr_destroy` — initialize and destroy a barrier attribute object

# SYNOPSIS

POSIX Threads Library (libpthread, -lpthread)
`#include <pthread.h>`

int
`pthread_barrierattr_init`(pthread_barrierattr_t *attr);

int
`pthread_barrierattr_destroy`(pthread_barrierattr_t *attr);

# DESCRIPTION

The `pthread_barrierattr_init`() function creates a new barrier attribute object.

The `pthread_barrierattr_destroy`() function frees the resources allocated for attr.

# RETURN VALUES

If successful, `pthread_barrierattr_init`() and `pthread_barrierattr_destroy`() return zero; otherwise an error number is returned to indicate the error.

# ERRORS

`pthread_barrierattr_init`() will fail if:

[`EINVAL`]
  The value specified by attr is invalid.
[`ENOMEM`]
  The process cannot allocate enough memory to create another barrier attribute object.

`pthread_barrierattr_destroy`() will fail if:

[`EINVAL`]
  The value specified by attr is invalid.

# SEE ALSO

pthread_barrier_init(3), pthread_barrier_wait(3), pthread_barrierattr_getpshared(3)

# STANDARDS

`pthread_barrierattr_init`() and `pthread_barrierattr_destroy`() conform to IEEE Std 1003.1-2008 (“POSIX.1”).

June 7, 2025 | Debian