xref: /netbsd-src/lib/libpthread/pthread_barrierattr.3 (revision d06479fa8dcf944f5964ed1b6a931ebb0e488100)
1*d06479faSabhinav.\" $NetBSD: pthread_barrierattr.3,v 1.13 2017/10/22 18:37:01 abhinav Exp $
2380bb3a8Snathanw.\"
3380bb3a8Snathanw.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4380bb3a8Snathanw.\" All rights reserved.
5380bb3a8Snathanw.\" Redistribution and use in source and binary forms, with or without
6380bb3a8Snathanw.\" modification, are permitted provided that the following conditions
7380bb3a8Snathanw.\" are met:
8380bb3a8Snathanw.\" 1. Redistributions of source code must retain the above copyright
9380bb3a8Snathanw.\"    notice, this list of conditions and the following disclaimer.
10380bb3a8Snathanw.\" 2. Redistributions in binary form must reproduce the above copyright
11380bb3a8Snathanw.\"    notice, this list of conditions and the following disclaimer in the
12380bb3a8Snathanw.\"    documentation and/or other materials provided with the distribution.
13380bb3a8Snathanw.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
14380bb3a8Snathanw.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15380bb3a8Snathanw.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16380bb3a8Snathanw.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
17380bb3a8Snathanw.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18380bb3a8Snathanw.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19380bb3a8Snathanw.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20380bb3a8Snathanw.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21380bb3a8Snathanw.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22380bb3a8Snathanw.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23380bb3a8Snathanw.\" POSSIBILITY OF SUCH DAMAGE.
24380bb3a8Snathanw.\"
257cf7644fSchristos.Dd June 12, 2016
26380bb3a8Snathanw.Dt PTHREAD_BARRIERATTR 3
27380bb3a8Snathanw.Os
28380bb3a8Snathanw.Sh NAME
29380bb3a8Snathanw.Nm pthread_barrierattr_init ,
30380bb3a8Snathanw.Nm pthread_barrierattr_destroy ,
317cf7644fSchristos.Nm pthread_barrierattr_getpshared ,
327cf7644fSchristos.Nm pthread_barrierattr_setpshared
33380bb3a8Snathanw.Nd barrier attribute operations
34380bb3a8Snathanw.Sh LIBRARY
35380bb3a8Snathanw.Lb libpthread
36380bb3a8Snathanw.Sh SYNOPSIS
37380bb3a8Snathanw.In pthread.h
38380bb3a8Snathanw.Ft int
39380bb3a8Snathanw.Fn pthread_barrierattr_init "pthread_barrierattr_t *attr"
40380bb3a8Snathanw.Ft int
41380bb3a8Snathanw.Fn pthread_barrierattr_destroy "pthread_barrierattr_t *attr"
427cf7644fSchristos.Ft int
437cf7644fSchristos.Fn pthread_barrierattr_getpshared "const pthread_barrierattr_t * __restrict attr" "int * __restrict pshared"
447cf7644fSchristos.Ft int
457cf7644fSchristos.Fn pthread_barrierattr_setpshared "pthread_barrierattr_t * attr" "int pshared"
46380bb3a8Snathanw.Sh DESCRIPTION
4716fcf35fSjruohoBarrier attributes are used to specify parameters to be used with
4816fcf35fSjruoho.Xr pthread_barrier_init 3 .
49380bb3a8SnathanwOne attribute object can be used in multiple calls to
50380bb3a8Snathanw.Fn pthread_barrier_init ,
51380bb3a8Snathanwwith or without modifications between calls.
52380bb3a8Snathanw.Pp
53380bb3a8SnathanwThe
54380bb3a8Snathanw.Fn pthread_barrierattr_init
55380bb3a8Snathanwfunction initializes
56380bb3a8Snathanw.Fa attr
5716fcf35fSjruohowith the default barrier attributes.
58380bb3a8Snathanw.Pp
59380bb3a8SnathanwThe
60380bb3a8Snathanw.Fn pthread_barrierattr_destroy
61380bb3a8Snathanwfunction destroys
62380bb3a8Snathanw.Fa attr .
637cf7644fSchristos.Pp
647cf7644fSchristosThe
657cf7644fSchristos.Fn pthread_barrierattr_getpshared
667cf7644fSchristosfunction shall obtain the value of the process-shared attribute
677cf7644fSchristosfrom the attributes object referenced by
687cf7644fSchristos.Fa attr .
697cf7644fSchristos.Pp
707cf7644fSchristosThe
717cf7644fSchristos.Fn pthread_barrierattr_setpshared
727cf7644fSchristosfunction shall set the process-shared attribute in an initialized
737cf7644fSchristosattributes object referenced by
747cf7644fSchristos.Fa attr .
75380bb3a8Snathanw.Sh RETURN VALUES
76380bb3a8SnathanwIf successful, these functions return 0.
7785cc64daSwizOtherwise, an error number is returned to indicate the error.
78380bb3a8Snathanw.Sh ERRORS
79950e52c1SjruohoNo error codes are defined for
80950e52c1Sjruoho.Fn pthread_barrierattr_init .
81950e52c1Sjruoho.Pp
82950e52c1SjruohoThe
83950e52c1Sjruoho.Fn pthread_barrierattr_destroy
842fb2239cSwizfunction may fail if:
85950e52c1Sjruoho.Bl -tag -width Er
86950e52c1Sjruoho.It Bq Er EINVAL
87950e52c1SjruohoThe value specified by
88950e52c1Sjruoho.Fa attr
89950e52c1Sjruohois invalid.
90950e52c1Sjruoho.El
917cf7644fSchristos.Pp
927cf7644fSchristosThe
937cf7644fSchristos.Fn pthread_barrierattr_getpshared
947cf7644fSchristosand
957cf7644fSchristos.Fn pthread_barrierattr_setpshared
963a2c8ba9Sabhinavfunctions may fail if:
977cf7644fSchristos.Bl -tag -width Er
987cf7644fSchristos.It Bq Er EINVAL
997cf7644fSchristosThe value specified by
1007cf7644fSchristos.Fa attr
1017cf7644fSchristosis invalid.
1027cf7644fSchristos.El
103380bb3a8Snathanw.Sh SEE ALSO
104380bb3a8Snathanw.Xr pthread_barrier_init 3
105380bb3a8Snathanw.Sh STANDARDS
106*d06479faSabhinavThese functions conform to
107380bb3a8Snathanw.St -p1003.1-2001 .
1087cf7644fSchristos.Sh BUGS
1097cf7644fSchristosThe
1107cf7644fSchristos.Fn pthread_barrierattr_getpshared
1117cf7644fSchristosand
1127cf7644fSchristos.Fn pthread_barrierattr_setpshared
1137cf7644fSchristosfunctions are hidden by default since only thread shared attributes
1147cf7644fSchristosare supported.
115