xref: /freebsd/share/man/man3/pthread_barrierattr.3 (revision 2357939bc239bd5334a169b62313806178dd8f30)
1.\" Copyright (c) 2004 Michael Telahun Makonnen
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.\" Note: The date here should be updated whenever a non-trivial
28.\" change is made to the manual page.
29.Dd February 19, 2004
30.Dt PTHREAD_BARRIERATTR_DESTROY 3 PTHREAD_BARRIERATTR_GETPSHARED 3 PTHREAD_BARRIERATTR_INIT 3 PTHREAD_BARRIERATTR_SETPSHARED 3
31.Os
32.Sh NAME
33.Nm pthread_barrierattr_destroy pthread_barrierattr_getpshared
34.Nm pthread_barrierattr_init pthread_barrierattr_setpshared
35.Nd "manipulate a barrier attribute object"
36.Sh LIBRARY
37.Lb libpthread
38.Lb libthr
39.Sh SYNOPSIS
40.In pthread.h
41.Ft int
42.Fn pthread_barrierattr_destroy "pthread_barrierattr_t *attr"
43.Ft int
44.Fn pthread_barrierattr_getpshared "const pthread_barrierattr_t *attr" "int *pshared"
45.Ft int
46.Fn pthread_barrierattr_init "pthread_barrierattr_t *attr"
47.Ft int
48.Fn pthread_barrierattr_setpshared "pthread_barrierattr_t *attr" "int pshared"
49.Sh DESCRIPTION
50The
51.Fn pthread_barrierattr_init
52function will initialize
53.Fa attr
54with default attributes.
55The
56.Fn pthread_barrierattr_destroy
57function will destroy
58.Fa attr
59and release any resources that may have been allocated on its behalf.
60.Pp
61The
62.Fn pthread_barrierattr_getpshared
63function will put the value of the process-shared attribute from
64.Fa attr
65into the memory area pointed to by
66.Fa pshared .
67The
68.Fn pthread_barrierattr_setpshared
69function will set the process-shared attribute of
70.Fa attr
71to the value specified in
72.Fa pshared.
73The argument
74.Fa pshared
75may have one of the following values:
76.Bl -tag -width ".Dv PTHREAD_PROCESS_PRIVATE"
77.It Dv PTHREAD_PROCESS_PRIVATE
78The barrier object it is attached to may only be accessed by
79threads in the same process as the one that created the object.
80.It Dv PTHREAD_PROCESS_SHARED
81The barrier object it is attached to may be accessed by
82threads in processes other than the one that created the object.
83.El
84.Sh DIAGNOSTICS
85If successful all these functions will return zero.
86Otherwise an error number will be returned to indicate the error.
87.Pp
88None of these functions will return EINTR.
89.Pp
90.Sh ERRORS
91The
92.Fn pthread_barrierattr_destroy ,
93.Fn pthread_barrierattr_getpshared
94and
95.Fn pthread_barrierattr_setpshared
96functions may fail if:
97.Bl -tag -width Er
98.It Bq Er EINVAL
99The value specified by
100.Fa attr
101is invalid.
102.El
103.Pp
104The
105.Fn pthread_barrierattr_init
106function will fail if:
107.Bl -tag -width Er
108.It Bq Er ENOMEM
109Insufficient memory to initialize the barrier attribute object
110.Fa attr .
111.El
112.Pp
113The
114.Fn pthread_barrierattr_setpshared
115function will fail if:
116.Bl -tag -width Er
117.It Bq Er EINVAL
118The value specified in
119.Fa pshared
120is not one of the allowed values.
121.El
122.Sh SEE ALSO
123.Xr pthread_barrier_destroy 3 ,
124.Xr pthread_barrier_init 3 ,
125.Xr pthread_barrier_wait 3 ,
126.Sh HISTORY
127The
128.Fn pthread_barrierattr
129functions first appeared in
130.Lb libpthread
131in
132.Fx 5.2 ,
133and in
134.Lb libthr
135in
136.Fx 5.3 .
137.Sh BUGS
138The implementation of
139.Fn pthread_barriers
140does not fully conform to
141.St -p1003.2
142because the process-shared attribute is ignored in
143.Lb libthr ,
144and in
145.Lb libpthread
146if any value other than
147.Dv PTHREAD_PROCESSES_PRIVATE
148is specified in a call to
149.Fn pthread_barrierattr_setpshared
150it will return EINVAL.
151