PTHREAD_BARRIERATTR(3)
π PTHREAD_BARRIERATTR(3) π
okay bestie, this page comes from the Library Functions Manual, and itβs all about the barrier attribute besties. π«Ά
πΈ NAME πΈ
pthread_barrierattr_destroy, pthread_barrierattr_getpshared, pthread_barrierattr_init, and pthread_barrierattr_setpshared β together these functions manipulate a barrier attribute object. periodt. π
π«Ά LIBRARY π«Ά
POSIX Threads Library β thatβs libpthread, -lpthread, no cap. β¨
β¨ SYNOPSIS β¨
#include <pthread.h>
int
pthread_barrierattr_destroy(pthread_barrierattr_t *attr);
int
pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict attr,
int *restrict pshared);
int
pthread_barrierattr_init(pthread_barrierattr_t *attr);
int
pthread_barrierattr_setpshared(pthread_barrierattr_t *attr,
int pshared);
π DESCRIPTION π
pthread_barrierattr_init() is the glow-up moment: it will initialize attr with default attributes. π
pthread_barrierattr_destroy() is the cleanup queen: it will destroy attr and release any resources that may have been allocated on its behalf. π§
pthread_barrierattr_getpshared() will put the value of the process-shared attribute from attr into the memory area pointed to by pshared. pthread_barrierattr_setpshared() will set the process-shared attribute of attr to the value specified in pshared. π₯
The argument pshared may have one of these values, and thatβs literally the list:
PTHREAD_PROCESS_PRIVATEβ The barrier object it is attached to may only be accessed by threads in the same process as the one that created the object.PTHREAD_PROCESS_SHAREDβ The barrier object it is attached to may be accessed by threads in processes other than the one that created the object.
π RETURN VALUES π
If successful, all these functions will return zero. Otherwise, an error number will be returned to indicate the error. π
None of these functions will return EINTR. not me checking that twice, but there it is. π
π ERRORS π
The pthread_barrierattr_destroy(), pthread_barrierattr_getpshared() and pthread_barrierattr_setpshared() functions may fail if:
[EINVAL]β The value specified byattris invalid.
The pthread_barrierattr_init() function will fail if:
[ENOMEM]β Insufficient memory to initialize the barrier attribute objectattr.
The pthread_barrierattr_setpshared() function will fail if:
[EINVAL]β The value specified inpsharedis not one of the allowed values.
π¦ SEE ALSO π¦
π HISTORY π
The pthread_barrierattr_*() functions first appeared in N:M Threading Library (libkse, -lkse) in FreeBSD 5.2, and in 1:1 Threading Library (libthr, -lthr) in FreeBSD 5.3. Support for process-shared barriers appeared in FreeBSD 11.0. iconic lore, honestly. π
β xoxo, your Debian bestie π August 17, 2018 Β· PTHREAD_BARRIERATTR(3) Β· mwah π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2004 Michael Telahun Makonnen
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms