pthread_barrier_wait()

synchronize at a barrier 

Advanced Realtime Threads


SYNOPSIS

#include <pthread.h>

int pthread_barrier_wait(pthread_barrier_t *barrier);


DESCRIPTION

The pthread_barrier_wait() function synchronizes participating threads at the barrier pointed to by the barrier argument. The calling thread blocks until the required number of threads have called pthread_barrier_wait() specifying barrier.

When the required number of threads have called pthread_barrier_wait() specifying the barrier, the constant PTHREAD_BARRIER_SERIAL_THREAD is returned to one thread and zero is returned to each of the remaining threads. The barrier is then reset to the state it had after the most recent pthread_barrier_init() call that referenced it.

The pthread_barrier_wait() function should not be used with an uninitialized barrier.

When a thread blocked on a barrier receives a signal, that thread resumes waiting at the barrier upon return from the signal handler if the required number of threads have not arrived at the barrier while the signal handler was executing. Otherwise, the thread continues as normal from the completed barrier wait.

A thread that has blocked on a barrier does not prevent any unblocked thread that is eligible to use the same processing resources from eventually making forward progress in its execution. Eligibility for processing resources shall be determined by the scheduling policy.


PARAMETERS

barrier 

Points to a barrier object.


RETURN VALUES

When successful, the pthread_barrier_wait() function returns PTHREAD_BARRIER_SERIAL_THREAD for a single (arbitrary) thread synchronized at the barrier and zero for each of the other threads. Otherwise, it returns one of the following:

EINVAL 

The barrier argument does not point to an initialized barrier object.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_barrier_destroy()


PTC MKS Toolkit 10.5 Documentation Build 40.