1pthread_barrier_destroy(3CS)tandard C Library Functionpsthread_barrier_destroy(3C)
2
3
4

NAME

6       pthread_barrier_destroy,  pthread_barrier_init - destroy and initialize
7       a barrier object
8

SYNOPSIS

10       cc -mt [ flag... ] file... [ library... ]
11       #include <pthread.h>
12
13       int pthread_barrier_destroy(pthread_barrier_t *barrier);
14
15
16       int pthread_barrier_init(pthread_barrier_t *barrier,
17            const pthread_barrierattr_t *restrict attr, unsigned count);
18
19

DESCRIPTION

21       The pthread_barrier_destroy() function destroys the barrier  referenced
22       by  barrier  and releases any resources used by the barrier. The effect
23       of subsequent use of the barrier is  undefined  until  the  barrier  is
24       reinitialized by another call to pthread_barrier_init(). An implementa‐
25       tion can use this function to set barrier  to  an  invalid  value.  The
26       results  are  undefined if pthread_barrier_destroy() is called when any
27       thread is blocked on the barrier, or if this function is called with an
28       uninitialized barrier.
29
30
31       The pthread_barrier_init() function allocates any resources required to
32       use the barrier referenced by barrier and initializes the barrier  with
33       attributes  referenced  by  attr.  If attr is NULL, the default barrier
34       attributes are used; the effect is the same as passing the address of a
35       default  barrier  attributes  object.  The  results  are  undefined  if
36       pthread_barrier_init() is called when any thread is blocked on the bar‐
37       rier  (that  is,  has  not  returned  from the pthread_barrier_wait(3C)
38       call). The results are undefined if a barrier  is  used  without  first
39       being  initialized. The results are undefined if pthread_barrier_init()
40       is called specifying an already initialized barrier.
41
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 0.
46
47
48       If the pthread_barrier_init() function fails, the barrier is  not  ini‐
49       tialized and the contents of barrier are undefined.
50
51
52       Only  the  object referenced by barrier can be used for performing syn‐
53       chronization. The result of referring to copies of that object in calls
54       to pthread_barrier_destroy() or pthread_barrier_wait() is undefined.
55

RETURN VALUES

57       Upon  successful  completion,  these functions returns 0. Otherwise, an
58       error number is returned to indicate the error.
59

ERRORS

61       The pthread_barrier_init() function will fail if:
62
63       EAGAIN    The  system  lacks  the  necessary  resources  to  initialize
64                 another barrier.
65
66
67       EINVAL    The value specified by count is equal to 0.
68
69
70       ENOMEM    Insufficient memory exists to initialize the barrier.
71
72
73
74       The pthread_barrier_init() function may fail if:
75
76       EBUSY     The  implementation has detected an attempt to destroy a bar‐
77                 rier while it is in use (for example, while being used  in  a
78                 pthread_barrier_wait() call) by another thread.
79
80
81       EINVAL    The value specified by attr is invalid.
82
83
84
85       The pthread_barrier_destroy() function may fail if:
86
87       EBUSY     The  implementation has detected an attempt to destroy a bar‐
88                 rier while it is in use (for example, while being used  in  a
89                 pthread_barrier_wait() call) by another thread.
90
91
92       EINVAL    The value specified by barrier is invalid.
93
94

ATTRIBUTES

96       See attributes(5) for descriptions of the following attributes:
97
98
99
100
101       ┌─────────────────────────────┬─────────────────────────────┐
102       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
103       ├─────────────────────────────┼─────────────────────────────┤
104       │Interface Stability          │Standard                     │
105       ├─────────────────────────────┼─────────────────────────────┤
106       │MT-Level                     │MT-Safe                      │
107       └─────────────────────────────┴─────────────────────────────┘
108

SEE ALSO

110       pthread_barrier_wait(3C), attributes(5), standards(5)
111
112
113
114SunOS 5.11                        30 Jan 2004      pthread_barrier_destroy(3C)
Impressum