PTHREAD_BARRIERATTR_GETPSHARED(3) | Library Functions Manual | PTHREAD_BARRIERATTR_GETPSHARED(3)

# NAME

`pthread_barrierattr_getpshared`, `pthread_barrierattr_setpshared` — get or set the process-shared attribute of the barrier attribute's object

# SYNOPSIS

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

int
`pthread_barrierattr_getpshared`(pthread_barrierattr_t *attr, int *pshared);

int
`pthread_barrierattr_setpshared`(pthread_barrierattr_t *attr, int pshared);

# DESCRIPTION

The `pthread_barrierattr_getpshared`() function writes in pshared the current process-shared attribute value.

The `pthread_barrierattr_setpshared`() function sets the process-shared attribute as indicated in pshared.

# RETURN VALUES

If successful, `pthread_barrierattr_getpshared`() and `pthread_barrierattr_setpshared`() will return zero, otherwise an error number will be returned to indicate the error.

# ERRORS

`pthread_barrierattr_getpshared`() will fail if:

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

`pthread_barrierattr_setpshared`() will fail if:

[`EINVAL`]
  The value specified by attr is invalid.
[`ENOTSUP`]
  The value specified by pshared is not PTHREAD_PROCESS_PRIVATE.

# SEE ALSO

pthread_barrier_init(3), pthread_barrier_wait(3), pthread_barrierattr_init(3)

# STANDARDS

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

# BUGS

Currently only private barriers are supported and the pshared attribute is always set that way. Any attempts to change that value will trigger `ENOTSUP`.

June 7, 2025 | Debian