barrier_wait

Causes the thread to wait on the barrier.

Library:LibC
Classification:UNIX International
Service:Synchronization

Syntax

  #include <synch.h>
   
  int   barrier_wait  (
     barrier_t   *bp );
  

Parameters

bp

(IN) Points to the barrier.

Return Values

If successful, returns zero; otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

9

EINVAL

The bp parameter is invalid..

105

ENOCONTEXT

The calling thread has no context.

Remarks

The barrier_wait function causes the calling thread to block until the required number of threads have also called the barrier_wait function. When the count reaches this limit, all threads are released to resume execution. The barrier is reset when the last waiting thread is released.

A barrier is not guaranteed to be a FIFO. You can make no assumptions about the order in which the threads are released.

See Also