1c5e7e03aSRuslan Ermilov.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>. 24c089f4dSJason Evans.\" All rights reserved. 34c089f4dSJason Evans.\" 44c089f4dSJason Evans.\" Redistribution and use in source and binary forms, with or without 54c089f4dSJason Evans.\" modification, are permitted provided that the following conditions 64c089f4dSJason Evans.\" are met: 74c089f4dSJason Evans.\" 1. Redistributions of source code must retain the above copyright 84c089f4dSJason Evans.\" notice(s), this list of conditions and the following disclaimer as 94c089f4dSJason Evans.\" the first lines of this file unmodified other than the possible 104c089f4dSJason Evans.\" addition of one or more copyright notices. 114c089f4dSJason Evans.\" 2. Redistributions in binary form must reproduce the above copyright 124c089f4dSJason Evans.\" notice(s), this list of conditions and the following disclaimer in 134c089f4dSJason Evans.\" the documentation and/or other materials provided with the 144c089f4dSJason Evans.\" distribution. 154c089f4dSJason Evans.\" 164c089f4dSJason Evans.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 174c089f4dSJason Evans.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 184c089f4dSJason Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 194c089f4dSJason Evans.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 204c089f4dSJason Evans.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 214c089f4dSJason Evans.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 224c089f4dSJason Evans.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 234c089f4dSJason Evans.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 244c089f4dSJason Evans.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 254c089f4dSJason Evans.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 264c089f4dSJason Evans.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274c089f4dSJason Evans.\" 284c089f4dSJason Evans.\" $FreeBSD$ 29febae919SJilles Tjoelker.Dd May 9, 2010 304c089f4dSJason Evans.Dt PTHREAD_CONDATTR 3 314c089f4dSJason Evans.Os 324c089f4dSJason Evans.Sh NAME 332a53c5ecSAlexey Zelkin.Nm pthread_condattr_init , 34febae919SJilles Tjoelker.Nm pthread_condattr_destroy , 35febae919SJilles Tjoelker.Nm pthread_condattr_getclock , 36febae919SJilles Tjoelker.Nm pthread_condattr_setclock , 37febae919SJilles Tjoelker.Nm pthread_condattr_getpshared , 38*a3fb6da9SGlen Barber.Nm pthread_condattr_setpshared 394c089f4dSJason Evans.Nd condition attribute operations 404c089f4dSJason Evans.Sh LIBRARY 41ec7452f1SRuslan Ermilov.Lb libpthread 424c089f4dSJason Evans.Sh SYNOPSIS 4332eef9aeSRuslan Ermilov.In pthread.h 444c089f4dSJason Evans.Ft int 454c089f4dSJason Evans.Fn pthread_condattr_init "pthread_condattr_t *attr" 464c089f4dSJason Evans.Ft int 474c089f4dSJason Evans.Fn pthread_condattr_destroy "pthread_condattr_t *attr" 48febae919SJilles Tjoelker.Ft int 49febae919SJilles Tjoelker.Fn pthread_condattr_getclock "pthread_condattr_t * restrict attr" "clock_t * restrict clock_id" 50febae919SJilles Tjoelker.Ft int 51febae919SJilles Tjoelker.Fn pthread_condattr_setclock "pthread_condattr_t *attr" "clock_t clock_id" 52febae919SJilles Tjoelker.Ft int 53febae919SJilles Tjoelker.Fn pthread_condattr_getpshared "pthread_condattr_t * restrict attr" "int * restrict pshared" 54febae919SJilles Tjoelker.Ft int 55febae919SJilles Tjoelker.Fn pthread_condattr_setpshared "pthread_condattr_t *attr" "int pshared" 564c089f4dSJason Evans.Sh DESCRIPTION 574c089f4dSJason EvansCondition attribute objects are used to specify parameters to 584c089f4dSJason Evans.Fn pthread_cond_init . 592a53c5ecSAlexey Zelkin.Pp 604c089f4dSJason EvansThe 614c089f4dSJason Evans.Fn pthread_condattr_init 624c089f4dSJason Evansfunction initializes a condition attribute object with the default attributes. 632a53c5ecSAlexey Zelkin.Pp 644c089f4dSJason EvansThe 654c089f4dSJason Evans.Fn pthread_condattr_destroy 664c089f4dSJason Evansfunction destroys a condition attribute object. 67febae919SJilles Tjoelker.Pp 68febae919SJilles TjoelkerThe 69febae919SJilles Tjoelker.Fn pthread_condattr_getclock 70febae919SJilles Tjoelkerfunction will put the value of the clock attribute from 71febae919SJilles Tjoelker.Fa attr 72febae919SJilles Tjoelkerinto the memory area pointed to by 73febae919SJilles Tjoelker.Fa clock_id . 74febae919SJilles TjoelkerThe 75febae919SJilles Tjoelker.Fn pthread_condattr_setclock 76febae919SJilles Tjoelkerfunction will set the clock attribute of 77febae919SJilles Tjoelker.Fa attr 78febae919SJilles Tjoelkerto the value specified in 79febae919SJilles Tjoelker.Fa clock_id . 80febae919SJilles TjoelkerThe clock attribute affects the interpretation of 81febae919SJilles Tjoelker.Fa abstime 82febae919SJilles Tjoelkerin 83febae919SJilles Tjoelker.Xr pthread_cond_timedwait 3 84febae919SJilles Tjoelkerand may be set to 85febae919SJilles Tjoelker.Dv CLOCK_REALTIME 86febae919SJilles Tjoelker(default) 87febae919SJilles Tjoelkeror 88febae919SJilles Tjoelker.Dv CLOCK_MONOTONIC . 89febae919SJilles Tjoelker.Pp 90febae919SJilles TjoelkerThe 91febae919SJilles Tjoelker.Fn pthread_condattr_getpshared 92febae919SJilles Tjoelkerfunction will put the value of the process-shared attribute from 93febae919SJilles Tjoelker.Fa attr 94febae919SJilles Tjoelkerinto the memory area pointed to by 95febae919SJilles Tjoelker.Fa pshared . 96febae919SJilles TjoelkerThe 97febae919SJilles Tjoelker.Fn pthread_condattr_setpshared 98febae919SJilles Tjoelkerfunction will set the process-shared attribute of 99febae919SJilles Tjoelker.Fa attr 100febae919SJilles Tjoelkerto the value specified in 101febae919SJilles Tjoelker.Fa pshared . 102febae919SJilles TjoelkerThe argument 103febae919SJilles Tjoelker.Fa pshared 104febae919SJilles Tjoelkermay have one of the following values: 105febae919SJilles Tjoelker.Bl -tag -width ".Dv PTHREAD_PROCESS_PRIVATE" 106febae919SJilles Tjoelker.It Dv PTHREAD_PROCESS_PRIVATE 107febae919SJilles TjoelkerThe condition variable it is attached to may only be accessed by 108febae919SJilles Tjoelkerthreads in the same process as the one that created the object. 109febae919SJilles Tjoelker.It Dv PTHREAD_PROCESS_SHARED 110febae919SJilles TjoelkerThe condition variable it is attached to may be accessed by 111febae919SJilles Tjoelkerthreads in processes other than the one that created the object. 112febae919SJilles Tjoelker.El 1134c089f4dSJason Evans.Sh RETURN VALUES 1144c089f4dSJason EvansIf successful, these functions return 0. 1154c089f4dSJason EvansOtherwise, an error number is returned to indicate the error. 1164c089f4dSJason Evans.Sh ERRORS 1179d09157aSPhilippe CharnierThe 1184c089f4dSJason Evans.Fn pthread_condattr_init 1199d09157aSPhilippe Charnierfunction will fail if: 1204c089f4dSJason Evans.Bl -tag -width Er 1214c089f4dSJason Evans.It Bq Er ENOMEM 1224c089f4dSJason EvansOut of memory. 1234c089f4dSJason Evans.El 1242a53c5ecSAlexey Zelkin.Pp 1259d09157aSPhilippe CharnierThe 1264c089f4dSJason Evans.Fn pthread_condattr_destroy 1279d09157aSPhilippe Charnierfunction will fail if: 1284c089f4dSJason Evans.Bl -tag -width Er 1294c089f4dSJason Evans.It Bq Er EINVAL 1304c089f4dSJason EvansInvalid value for 1314c089f4dSJason Evans.Fa attr . 13242635956SRuslan Ermilov.El 133febae919SJilles Tjoelker.Pp 134febae919SJilles TjoelkerThe 135febae919SJilles Tjoelker.Fn pthread_condattr_setclock 136febae919SJilles Tjoelkerfunction will fail if: 137febae919SJilles Tjoelker.Bl -tag -width Er 138febae919SJilles Tjoelker.It Bq Er EINVAL 139febae919SJilles TjoelkerThe value specified in 140febae919SJilles Tjoelker.Fa clock_id 141febae919SJilles Tjoelkeris not one of the allowed values. 142febae919SJilles Tjoelker.El 143febae919SJilles Tjoelker.Pp 144febae919SJilles TjoelkerThe 145febae919SJilles Tjoelker.Fn pthread_condattr_setpshared 146febae919SJilles Tjoelkerfunction will fail if: 147febae919SJilles Tjoelker.Bl -tag -width Er 148febae919SJilles Tjoelker.It Bq Er EINVAL 149febae919SJilles TjoelkerThe value specified in 150febae919SJilles Tjoelker.Fa pshared 151febae919SJilles Tjoelkeris not one of the allowed values. 152febae919SJilles Tjoelker.El 1534c089f4dSJason Evans.Sh SEE ALSO 154febae919SJilles Tjoelker.Xr pthread_cond_init 3 , 155febae919SJilles Tjoelker.Xr pthread_cond_timedwait 3 1564c089f4dSJason Evans.Sh STANDARDS 1579d09157aSPhilippe CharnierThe 1584c089f4dSJason Evans.Fn pthread_condattr_init 1594c089f4dSJason Evansand 1604c089f4dSJason Evans.Fn pthread_condattr_destroy 1619d09157aSPhilippe Charnierfunctions conform to 162589a5e34SRuslan Ermilov.St -p1003.1-96 163febae919SJilles Tjoelker.Sh BUGS 164febae919SJilles TjoelkerThe implementation of 165febae919SJilles Tjoelkercondition variables 166febae919SJilles Tjoelkerdoes not fully conform to 167febae919SJilles Tjoelker.St -p1003.2 168febae919SJilles Tjoelkerbecause the process-shared attribute is ignored; 169febae919SJilles Tjoelkerif any value other than 170febae919SJilles Tjoelker.Dv PTHREAD_PROCESSES_PRIVATE 171febae919SJilles Tjoelkeris specified in a call to 172febae919SJilles Tjoelker.Fn pthread_condattr_setpshared , 173febae919SJilles Tjoelkerit will return 174febae919SJilles Tjoelker.Er EINVAL . 175