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 (ADVANCED REALTIME THREADS)
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
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_destroy() function may fail if:
61
62       EBUSY  The  implementation has detected an attempt to destroy a barrier
63              while it  is  in  use  (for  example,  while  being  used  in  a
64              pthread_barrier_wait() call) by another thread.
65
66       EINVAL The value specified by barrier is invalid.
67
68
69       The pthread_barrier_init() function shall fail if:
70
71       EAGAIN The  system  lacks the necessary resources to initialize another
72              barrier.
73
74       EINVAL The value specified by count is equal to zero.
75
76       ENOMEM Insufficient memory exists to initialize the barrier.
77
78
79       The pthread_barrier_init() function may fail if:
80
81       EBUSY  The implementation has detected an  attempt  to  reinitialize  a
82              barrier  while  it is in use (for example, while being used in a
83              pthread_barrier_wait() call) by another thread.
84
85       EINVAL The value specified by attr is invalid.
86
87
88       These functions shall not return an error code of [EINTR].
89
90       The following sections are informative.
91

EXAMPLES

93       None.
94

APPLICATION USAGE

96       The pthread_barrier_destroy() and pthread_barrier_init() functions  are
97       part of the Barriers option and need not be provided on all implementa‐
98       tions.
99

RATIONALE

101       None.
102

FUTURE DIRECTIONS

104       None.
105

SEE ALSO

107       pthread_barrier_wait(),    the    Base    Definitions     volume     of
108       IEEE Std 1003.1-2001, <pthread.h>
109
111       Portions  of  this text are reprinted and reproduced in electronic form
112       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
113       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
114       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
115       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
116       event of any discrepancy between this version and the original IEEE and
117       The  Open Group Standard, the original IEEE and The Open Group Standard
118       is the referee document. The original Standard can be  obtained  online
119       at http://www.opengroup.org/unix/online.html .
120
121
122
123IEEE/The Open Group                  2003          PTHREAD_BARRIER_DESTROY(3P)
Impressum