SyncBarrierWait_r()

QNX SDP8.0C Library ReferenceAPIDeveloper

Synchronize threads at the barrier

Note:
Don't use the SyncBarrierWait_r() kernel call directly; instead, use the POSIX function pthread_barrier_wait().

Synopsis:

#include <sys/neutrino.h>

int SyncBarrierWait_r ( sync_t * sync );

Arguments:

sync
A pointer to the sync_t object that is an initialized barrier.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The SyncBarrierWait_r() kernel call blocks threads at the barrier until the expected number of threads have called the function.

In an N-waiter barrier, the first N-1 threads to call the SyncBarrierWait_r() function on the barrier end up on the kernel object's waiting list and are blocked. The Nth thread unblocks all the other N-1 waiting threads.

Returns:

SyncBarrierWait_r()
The last thread to arrive at the barrier returns a value of -1, while the other threads return 0. If an error occurs, the function returns a positive value.

Errors:

EINVAL
The initialized barrier specified in sync is invalid.
EINTR
A signal was received while waiting for the threads.

Classification:

QNX OS

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: