posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_BARRIERS

POSIX Barriers option group. More...

Macros

#define PTHREAD_BARRIER_SERIAL_THREAD   1
 Returned by pthread_barrier_wait() to one (arbitrary) thread per barrier cycle.
 

Functions

int pthread_barrier_destroy (pthread_barrier_t *barrier)
 Destroy a barrier object.
 
int pthread_barrier_init (pthread_barrier_t *ZRESTRICT barrier, const pthread_barrierattr_t *ZRESTRICT attr, unsigned int count)
 Initialise a barrier object.
 
int pthread_barrier_wait (pthread_barrier_t *barrier)
 Synchronise participating threads at a barrier.
 
int pthread_barrierattr_destroy (pthread_barrierattr_t *attr)
 Destroy a barrier attributes object.
 
int pthread_barrierattr_getpshared (const pthread_barrierattr_t *ZRESTRICT attr, int *ZRESTRICT pshared)
 Get the process-shared attribute of a barrier attributes object.
 
int pthread_barrierattr_init (pthread_barrierattr_t *attr)
 Initialise a barrier attributes object with default values.
 
int pthread_barrierattr_setpshared (pthread_barrierattr_t *attr, int pshared)
 Set the process-shared attribute of a barrier attributes object.
 

Detailed Description

POSIX Barriers option group.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html

Macro Definition Documentation

◆ PTHREAD_BARRIER_SERIAL_THREAD

#define PTHREAD_BARRIER_SERIAL_THREAD   1

Returned by pthread_barrier_wait() to one (arbitrary) thread per barrier cycle.

Definition at line 36 of file pthread.h.

Function Documentation

◆ pthread_barrier_destroy()

int pthread_barrier_destroy ( pthread_barrier_t *  barrier)

Destroy a barrier object.

Parameters
barrierBarrier to destroy.
Returns
0 on success, or a positive error number on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrier_destroy.html

◆ pthread_barrier_init()

int pthread_barrier_init ( pthread_barrier_t *ZRESTRICT  barrier,
const pthread_barrierattr_t *ZRESTRICT  attr,
unsigned int  count 
)

Initialise a barrier object.

Parameters
barrierBarrier to initialise.
attrBarrier attributes, or NULL for defaults.
countNumber of threads that must call pthread_barrier_wait() before any proceeds.
Returns
0 on success, or a positive error number on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrier_init.html

◆ pthread_barrier_wait()

int pthread_barrier_wait ( pthread_barrier_t *  barrier)

Synchronise participating threads at a barrier.

Blocks until count threads have called this function on the same barrier. Exactly one thread receives PTHREAD_BARRIER_SERIAL_THREAD as the return value.

Parameters
barrierBarrier to wait on.
Returns
PTHREAD_BARRIER_SERIAL_THREAD for one thread, 0 for all others, or a positive error number on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrier_wait.html

◆ pthread_barrierattr_destroy()

int pthread_barrierattr_destroy ( pthread_barrierattr_t *  attr)

Destroy a barrier attributes object.

Parameters
attrBarrier attributes object to destroy.
Returns
0 on success, or a positive error number on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrierattr_destroy.html

◆ pthread_barrierattr_getpshared()

int pthread_barrierattr_getpshared ( const pthread_barrierattr_t *ZRESTRICT  attr,
int *ZRESTRICT  pshared 
)

Get the process-shared attribute of a barrier attributes object.

Parameters
attrBarrier attributes object.
psharedOutput: PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.
Returns
0 on success, or a positive error number on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrierattr_getpshared.html

◆ pthread_barrierattr_init()

int pthread_barrierattr_init ( pthread_barrierattr_t *  attr)

Initialise a barrier attributes object with default values.

Parameters
attrBarrier attributes object to initialise.
Returns
0 on success, or a positive error number on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrierattr_init.html

◆ pthread_barrierattr_setpshared()

int pthread_barrierattr_setpshared ( pthread_barrierattr_t *  attr,
int  pshared 
)

Set the process-shared attribute of a barrier attributes object.

Parameters
attrBarrier attributes object.
psharedPTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.
Returns
0 on success, or a positive error number on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_barrierattr_setpshared.html