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.Dd February 19, 2004 28.Dt PTHREAD_BARRIERATTR 3 29.Os 30.Sh NAME 31.Nm pthread_barrierattr_destroy , pthread_barrierattr_getpshared , 32.Nm pthread_barrierattr_init , pthread_barrierattr_setpshared 33.Nd "manipulate a barrier attribute object" 34.Sh LIBRARY 35.Lb libpthread 36.Lb libthr 37.Sh SYNOPSIS 38.In pthread.h 39.Ft int 40.Fn pthread_barrierattr_destroy "pthread_barrierattr_t *attr" 41.Ft int 42.Fn pthread_barrierattr_getpshared "const pthread_barrierattr_t *attr" "int *pshared" 43.Ft int 44.Fn pthread_barrierattr_init "pthread_barrierattr_t *attr" 45.Ft int 46.Fn pthread_barrierattr_setpshared "pthread_barrierattr_t *attr" "int pshared" 47.Sh DESCRIPTION 48The 49.Fn pthread_barrierattr_init 50function will initialize 51.Fa attr 52with default attributes. 53The 54.Fn pthread_barrierattr_destroy 55function will destroy 56.Fa attr 57and release any resources that may have been allocated on its behalf. 58.Pp 59The 60.Fn pthread_barrierattr_getpshared 61function will put the value of the process-shared attribute from 62.Fa attr 63into the memory area pointed to by 64.Fa pshared . 65The 66.Fn pthread_barrierattr_setpshared 67function will set the process-shared attribute of 68.Fa attr 69to the value specified in 70.Fa pshared . 71The argument 72.Fa pshared 73may have one of the following values: 74.Bl -tag -width ".Dv PTHREAD_PROCESS_PRIVATE" 75.It Dv PTHREAD_PROCESS_PRIVATE 76The barrier object it is attached to may only be accessed by 77threads in the same process as the one that created the object. 78.It Dv PTHREAD_PROCESS_SHARED 79The barrier object it is attached to may be accessed by 80threads in processes other than the one that created the object. 81.El 82.Sh RETURN VALUES 83If successful, all these functions will return zero. 84Otherwise, an error number will be returned to indicate the error. 85.Pp 86None of these functions will return 87.Er EINTR . 88.Sh ERRORS 89The 90.Fn pthread_barrierattr_destroy , 91.Fn pthread_barrierattr_getpshared 92and 93.Fn pthread_barrierattr_setpshared 94functions may fail if: 95.Bl -tag -width Er 96.It Bq Er EINVAL 97The value specified by 98.Fa attr 99is invalid. 100.El 101.Pp 102The 103.Fn pthread_barrierattr_init 104function will fail if: 105.Bl -tag -width Er 106.It Bq Er ENOMEM 107Insufficient memory to initialize the barrier attribute object 108.Fa attr . 109.El 110.Pp 111The 112.Fn pthread_barrierattr_setpshared 113function will fail if: 114.Bl -tag -width Er 115.It Bq Er EINVAL 116The value specified in 117.Fa pshared 118is not one of the allowed values. 119.El 120.Sh SEE ALSO 121.Xr pthread_barrier_destroy 3 , 122.Xr pthread_barrier_init 3 , 123.Xr pthread_barrier_wait 3 124.Sh HISTORY 125The 126.Fn pthread_barrierattr_* 127functions first appeared in 128.Lb libpthread 129in 130.Fx 5.2 , 131and in 132.Lb libthr 133in 134.Fx 5.3 . 135.Sh BUGS 136The implementation of 137barriers 138does not fully conform to 139.St -p1003.2 140because the process-shared attribute is ignored in 141.Lb libthr , 142and in 143.Lb libpthread ; 144if any value other than 145.Dv PTHREAD_PROCESSES_PRIVATE 146is specified in a call to 147.Fn pthread_barrierattr_setpshared , 148it will return 149.Er EINVAL . 150