Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_barrier_wait.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_barrier_wait.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_barrier_wait.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_barrier_wait.html on line 8

pthread_barrier_wait()

Synchronize participating threads at the barrier

Synopsis:

#include <sync.h>

int pthread_barrier_wait( pthread_barrier_t * barrier );

Arguments:

barrier
A pointer to the pthread_barrier_t object that you want to use to synchronize the threads. You must initialize the barrier by calling pthread_barrier_init() before calling pthread_barrier_wait().

Library:

libc

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

Description:

The pthread_barrier_wait() function synchronizes participating threads at the barrier referenced by barrier. The calling thread blocks — that is, it doesn't return from pthread_barrier_wait() — until the required number of threads have called pthread_barrier_wait(), specifying the barrier.

When the required number of threads have called pthread_barrier_wait() specifying the barrier, the function returns PTHREAD_BARRIER_SERIAL_THREAD to one unspecified thread, and zero to each of the remaining threads. At this point, the barrier is reset to the state it occupied as a result of the most recent pthread_barrier_init() function that referenced it.

The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in <pthread.h>, and its value is distinct from any other value that pthread_barrier_wait() returns.

If a signal is delivered to a thread blocked on a barrier, on return from the signal handler, the thread resumes waiting at the barrier as if it hadn't been interrupted.

Returns:

PTHREAD_BARRIER_SERIAL_THREAD to a single (arbitrary) thread synchronized at the barrier, and zero to each of the other threads; otherwise, pthread_barrier_wait() returns an error number:

EINVAL
The barrier argument isn't initialized.

Classification:

POSIX 1003.1 THR BAR

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pthread_barrier_destroy(), pthread_barrier_init()

Processes and Threads chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_barrier_wait.html on line 149

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_barrier_wait.html on line 149