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