1PTHREAD_BARRIER_WAIT(3P)   POSIX Programmer's Manual  PTHREAD_BARRIER_WAIT(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       pthread_barrier_wait - synchronize  at  a  barrier  (ADVANCED  REALTIME
13       THREADS)
14

SYNOPSIS

16       #include <pthread.h>
17
18       int pthread_barrier_wait(pthread_barrier_t *barrier);
19
20

DESCRIPTION

22       The  pthread_barrier_wait()  function  shall  synchronize participating
23       threads at the barrier referenced by barrier.  The calling thread shall
24       block  until  the  required  number of threads have called pthread_bar‐
25       rier_wait() specifying the barrier.
26
27       When the required number of threads have called  pthread_barrier_wait()
28       specifying  the  barrier,  the  constant  PTHREAD_BARRIER_SERIAL_THREAD
29       shall be returned to one unspecified thread and zero shall be  returned
30       to  each  of the remaining threads. At this point, the barrier shall be
31       reset to the state it had as a result of the most  recent  pthread_bar‐
32       rier_init() function that referenced it.
33
34       The  constant  PTHREAD_BARRIER_SERIAL_THREAD  is defined in <pthread.h>
35       and its value shall be  distinct  from  any  other  value  returned  by
36       pthread_barrier_wait().
37
38       The results are undefined if this function is called with an uninitial‐
39       ized barrier.
40
41       If a signal is delivered to a thread blocked on a barrier, upon  return
42       from  the signal handler the thread shall resume waiting at the barrier
43       if the barrier wait has not completed (that is, if the required  number
44       of  threads have not arrived at the barrier during the execution of the
45       signal handler); otherwise, the thread shall continue  as  normal  from
46       the  completed  barrier  wait.  Until  the thread in the signal handler
47       returns from it, it is unspecified whether other  threads  may  proceed
48       past the barrier once they have all reached it.
49
50       A  thread that has blocked on a barrier shall not prevent any unblocked
51       thread that is eligible to use the same processing resources from even‐
52       tually  making forward progress in its execution.  Eligibility for pro‐
53       cessing resources shall be determined by the scheduling policy.
54

RETURN VALUE

56       Upon successful completion, the pthread_barrier_wait()  function  shall
57       return  PTHREAD_BARRIER_SERIAL_THREAD  for  a single (arbitrary) thread
58       synchronized at the barrier and zero for each  of  the  other  threads.
59       Otherwise, an error number shall be returned to indicate the error.
60

ERRORS

62       The pthread_barrier_wait() function may fail if:
63
64       EINVAL The  value specified by barrier does not refer to an initialized
65              barrier object.
66
67
68       This function shall not return an error code of [EINTR].
69
70       The following sections are informative.
71

EXAMPLES

73       None.
74

APPLICATION USAGE

76       Applications using this function may be subject to priority  inversion,
77       as  discussed  in  the Base Definitions volume of IEEE Std 1003.1-2001,
78       Section 3.285, Priority Inversion.
79
80       The pthread_barrier_wait() function is part of the Barriers option  and
81       need not be provided on all implementations.
82

RATIONALE

84       None.
85

FUTURE DIRECTIONS

87       None.
88

SEE ALSO

90       pthread_barrier_destroy(),    the    Base    Definitions    volume   of
91       IEEE Std 1003.1-2001, <pthread.h>
92
94       Portions of this text are reprinted and reproduced in  electronic  form
95       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
96       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
97       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
98       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
99       event of any discrepancy between this version and the original IEEE and
100       The Open Group Standard, the original IEEE and The Open Group  Standard
101       is  the  referee document. The original Standard can be obtained online
102       at http://www.opengroup.org/unix/online.html .
103
104
105
106IEEE/The Open Group                  2003             PTHREAD_BARRIER_WAIT(3P)
Impressum