1PTHREAD_BARRIER_DESTROY(3P)POSIX Programmer's ManualPTHREAD_BARRIER_DESTROY(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
11

NAME

13       pthread_barrier_destroy, pthread_barrier_init — destroy and  initialize
14       a barrier object
15

SYNOPSIS

17       #include <pthread.h>
18
19       int pthread_barrier_destroy(pthread_barrier_t *barrier);
20       int pthread_barrier_init(pthread_barrier_t *restrict barrier,
21           const pthread_barrierattr_t *restrict attr, unsigned count);
22

DESCRIPTION

24       The pthread_barrier_destroy() function shall destroy the barrier refer‐
25       enced by barrier and release any resources used  by  the  barrier.  The
26       effect  of subsequent use of the barrier is undefined until the barrier
27       is reinitialized by another call to pthread_barrier_init().  An  imple‐
28       mentation may use this function to set barrier to an invalid value. The
29       results are undefined if pthread_barrier_destroy() is called  when  any
30       thread is blocked on the barrier, or if this function is called with an
31       uninitialized barrier.
32
33       The  pthread_barrier_init()  function  shall  allocate  any   resources
34       required  to use the barrier referenced by barrier and shall initialize
35       the barrier with attributes referenced by attr.  If attr is  NULL,  the
36       default  barrier  attributes  shall  be used; the effect is the same as
37       passing the address of a default barrier attributes object. The results
38       are  undefined  if  pthread_barrier_init() is called when any thread is
39       blocked on the barrier (that is, has not returned from the pthread_bar‐
40       rier_wait() call). The results are undefined if a barrier is used with‐
41       out first being initialized. The results are undefined if  pthread_bar‐
42       rier_init() is called specifying an already initialized barrier.
43
44       The  count  argument  specifies  the  number  of threads that must call
45       pthread_barrier_wait() before any of them successfully return from  the
46       call. The value specified by count must be greater than zero.
47
48       If  the pthread_barrier_init() function fails, the barrier shall not be
49       initialized and the contents of barrier are undefined.
50
51       Only the object referenced by barrier may be used for  performing  syn‐
52       chronization. The result of referring to copies of that object in calls
53       to pthread_barrier_destroy() or pthread_barrier_wait() is undefined.
54

RETURN VALUE

56       Upon successful completion, these functions shall return  zero;  other‐
57       wise, an error number shall be returned to indicate the error.
58

ERRORS

60       The pthread_barrier_init() function shall fail if:
61
62       EAGAIN The  system  lacks the necessary resources to initialize another
63              barrier.
64
65       EINVAL The value specified by count is equal to zero.
66
67       ENOMEM Insufficient memory exists to initialize the barrier.
68
69       These functions shall not return an error code of [EINTR].
70
71       The following sections are informative.
72

EXAMPLES

74       None.
75

APPLICATION USAGE

77       None.
78

RATIONALE

80       If an implementation detects that the value specified  by  the  barrier
81       argument  to pthread_barrier_destroy() does not refer to an initialized
82       barrier object, it is recommended that the  function  should  fail  and
83       report an [EINVAL] error.
84
85       If an implementation detects that the value specified by the attr argu‐
86       ment to pthread_barrier_init() does not refer to an initialized barrier
87       attributes  object, it is recommended that the function should fail and
88       report an [EINVAL] error.
89
90       If an implementation detects that the value specified  by  the  barrier
91       argument  to pthread_barrier_destroy() or pthread_barrier_init() refers
92       to a barrier that is in use (for example, in  a  pthread_barrier_wait()
93       call)  by  another  thread,  or detects that the value specified by the
94       barrier argument to pthread_barrier_init() refers to  an  already  ini‐
95       tialized  barrier  object,  it  is recommended that the function should
96       fail and report an [EBUSY] error.
97

FUTURE DIRECTIONS

99       None.
100

SEE ALSO

102       pthread_barrier_wait()
103
104       The Base Definitions volume of POSIX.1‐2008, <pthread.h>
105
107       Portions of this text are reprinted and reproduced in  electronic  form
108       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
109       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
110       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
111       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
112       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
113       event of any discrepancy between this version and the original IEEE and
114       The  Open Group Standard, the original IEEE and The Open Group Standard
115       is the referee document. The original Standard can be  obtained  online
116       at http://www.unix.org/online.html .
117
118       Any  typographical  or  formatting  errors that appear in this page are
119       most likely to have been introduced during the conversion of the source
120       files  to  man page format. To report such errors, see https://www.ker
121       nel.org/doc/man-pages/reporting_bugs.html .
122
123
124
125IEEE/The Open Group                  2013          PTHREAD_BARRIER_DESTROY(3P)
Impressum