1*86f9d4cdStedu.\" $OpenBSD: pthread_condattr_init.3,v 1.2 2013/06/05 03:44:50 tedu Exp $ 2dc411a7fSguenther.\" 3dc411a7fSguenther.\" Copyright (C) 2000 Jason Evans <jasone@freebsd.org>. 4dc411a7fSguenther.\" All rights reserved. 5dc411a7fSguenther.\" 6dc411a7fSguenther.\" Redistribution and use in source and binary forms, with or without 7dc411a7fSguenther.\" modification, are permitted provided that the following conditions 8dc411a7fSguenther.\" are met: 9dc411a7fSguenther.\" 1. Redistributions of source code must retain the above copyright 10dc411a7fSguenther.\" notice(s), this list of conditions and the following disclaimer as 11dc411a7fSguenther.\" the first lines of this file unmodified other than the possible 12dc411a7fSguenther.\" addition of one or more copyright notices. 13dc411a7fSguenther.\" 2. Redistributions in binary form must reproduce the above copyright 14dc411a7fSguenther.\" notice(s), this list of conditions and the following disclaimer in 15dc411a7fSguenther.\" the documentation and/or other materials provided with the 16dc411a7fSguenther.\" distribution. 17dc411a7fSguenther.\" 18dc411a7fSguenther.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 19dc411a7fSguenther.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20dc411a7fSguenther.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21dc411a7fSguenther.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 22dc411a7fSguenther.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23dc411a7fSguenther.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24dc411a7fSguenther.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25dc411a7fSguenther.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26dc411a7fSguenther.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 27dc411a7fSguenther.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 28dc411a7fSguenther.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29dc411a7fSguenther.\" 30dc411a7fSguenther.\" $FreeBSD: pthread_mutexattr.3,v 1.5 2001/07/15 07:53:26 dd Exp $ 31*86f9d4cdStedu.Dd $Mdocdate: June 5 2013 $ 32dc411a7fSguenther.Dt PTHREAD_CONDATTR_INIT 3 33dc411a7fSguenther.Os 34dc411a7fSguenther.Sh NAME 35dc411a7fSguenther.Nm pthread_condattr_init , 36dc411a7fSguenther.Nm pthread_condattr_destroy , 37dc411a7fSguenther.Nm pthread_condattr_setclock , 38dc411a7fSguenther.Nm pthread_condattr_getclock 39dc411a7fSguenther.Nd condition variable attribute operations 40dc411a7fSguenther.Sh SYNOPSIS 41*86f9d4cdStedu.In pthread.h 42dc411a7fSguenther.Ft int 43dc411a7fSguenther.Fn pthread_condattr_init "pthread_condattr_t *attr" 44dc411a7fSguenther.Ft int 45dc411a7fSguenther.Fn pthread_condattr_destroy "pthread_condattr_t *attr" 46dc411a7fSguenther.Ft int 47dc411a7fSguenther.Fn pthread_condattr_setclock "pthread_condattr_t *attr" "clockid_t clock_id" 48dc411a7fSguenther.Ft int 49dc411a7fSguenther.Fn pthread_condattr_getclock "pthread_condattr_t *attr" "clockid_t *clock_id" 50dc411a7fSguenther.Sh DESCRIPTION 51dc411a7fSguentherCondition variable attributes are used to specify parameters to 52dc411a7fSguenther.Fn pthread_cond_init . 53dc411a7fSguentherOne attribute object can be used in multiple calls to 54dc411a7fSguenther.Fn pthread_cond_init , 55dc411a7fSguentherwith or without modifications between calls. 56dc411a7fSguenther.Pp 57dc411a7fSguentherThe 58dc411a7fSguenther.Fn pthread_condattr_init 59dc411a7fSguentherfunction initializes 60dc411a7fSguenther.Fa attr 61dc411a7fSguentherwith all the default condition variable attributes. 62dc411a7fSguenther.Pp 63dc411a7fSguentherThe 64dc411a7fSguenther.Fn pthread_condattr_destroy 65dc411a7fSguentherfunction destroys 66dc411a7fSguenther.Fa attr . 67dc411a7fSguenther.Pp 68dc411a7fSguentherThe 69dc411a7fSguenther.Fn pthread_condattr_setclock 70dc411a7fSguentherfunction sets the clock attribute of 71dc411a7fSguenther.Fa attr 72dc411a7fSguentherto the value of the 73dc411a7fSguenther.Fa clock_id 74dc411a7fSguentherparameter. 75dc411a7fSguentherThe 76dc411a7fSguenther.Fn pthread_condattr_getclock 77dc411a7fSguentherfunction copies the value of the clock attribute from 78dc411a7fSguenther.Fa attr 79dc411a7fSguentherto the location pointed to by the 80dc411a7fSguenther.Fa clock_id 81dc411a7fSguentherparameter. 82dc411a7fSguentherThe clock attribute is the ID of the clock against which the timeout of 83dc411a7fSguenther.Fn pthread_cond_timedwait 84dc411a7fSguentheris compared; 85dc411a7fSguentherthe default value of the clock attribute is 86dc411a7fSguenther.Dv CLOCK_REALTIME . 87dc411a7fSguenther.Sh RETURN VALUES 88dc411a7fSguentherIf successful, these functions return 0. 89dc411a7fSguentherOtherwise, an error number is returned to indicate the error. 90dc411a7fSguenther.Sh ERRORS 91dc411a7fSguenther.Fn pthread_condattr_init 92dc411a7fSguentherwill fail if: 93dc411a7fSguenther.Bl -tag -width Er 94dc411a7fSguenther.It Bq Er ENOMEM 95dc411a7fSguentherOut of memory. 96dc411a7fSguenther.El 97dc411a7fSguenther.Pp 98dc411a7fSguenther.Fn pthread_condattr_setclock 99dc411a7fSguentherwill fail if: 100dc411a7fSguenther.Bl -tag -width Er 101dc411a7fSguenther.It Bq Er EINVAL 102dc411a7fSguentherThe value of 103dc411a7fSguenther.Fa clock_id 104dc411a7fSguentheris neither 105dc411a7fSguenther.Dv CLOCK_REALTIME 106dc411a7fSguenthernor 107dc411a7fSguenther.Dv CLOCK_MONOTONIC . 108dc411a7fSguenther.El 109dc411a7fSguenther.Sh SEE ALSO 110dc411a7fSguenther.Xr clock_gettime 2 , 111dc411a7fSguenther.Xr pthread_cond_init 3 112dc411a7fSguenther.Sh STANDARDS 113dc411a7fSguenther.Fn pthread_condattr_init , 114dc411a7fSguenther.Fn pthread_condattr_destroy , 115dc411a7fSguenther.Fn pthread_condattr_setclock , 116dc411a7fSguentherand 117dc411a7fSguenther.Fn pthread_condattr_getclock 118dc411a7fSguentherconform to 119dc411a7fSguenther.St -p1003.1-2008 120