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

NAME

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

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

72       None.
73

APPLICATION USAGE

75       None.
76

RATIONALE

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

FUTURE DIRECTIONS

97       None.
98

SEE ALSO

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