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