xref: /netbsd-src/lib/libpthread/pthread_condattr.3 (revision 38f9590df4f129e4ec29dd92dbfd777e04d39424)
1.\" $NetBSD: pthread_condattr.3,v 1.12 2017/03/28 17:42:52 maya Exp $
2.\"
3.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
14.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
17.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23.\" POSSIBILITY OF SUCH DAMAGE.
24.\"
25.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
26.\" All rights reserved.
27.\"
28.\" Redistribution and use in source and binary forms, with or without
29.\" modification, are permitted provided that the following conditions
30.\" are met:
31.\" 1. Redistributions of source code must retain the above copyright
32.\"    notice(s), this list of conditions and the following disclaimer as
33.\"    the first lines of this file unmodified other than the possible
34.\"    addition of one or more copyright notices.
35.\" 2. Redistributions in binary form must reproduce the above copyright
36.\"    notice(s), this list of conditions and the following disclaimer in
37.\"    the documentation and/or other materials provided with the
38.\"    distribution.
39.\"
40.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
41.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
44.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
45.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
46.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
47.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
48.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
49.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
50.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51.\"
52.\" $FreeBSD: src/lib/libpthread/man/pthread_condattr.3,v 1.10 2002/09/16 19:29:28 mini Exp $
53.Dd March 28, 2017
54.Dt PTHREAD_CONDATTR 3
55.Os
56.Sh NAME
57.Nm pthread_condattr_init ,
58.Nm pthread_condattr_getpshared ,
59.Nm pthread_condattr_setpshared ,
60.Nm pthread_condattr_getclock ,
61.Nm pthread_condattr_setclock
62.Nd condition attribute operations
63.Sh LIBRARY
64.Lb libpthread
65.Sh SYNOPSIS
66.In pthread.h
67.Ft int
68.Fn pthread_condattr_init "pthread_condattr_t *attr"
69.Ft int
70.Fn pthread_condattr_getclock "const pthread_condattr_t *__restrict attr" \
71"clockid_t * __restrict clock_id"
72.Ft int
73.Fn pthread_condattr_setclock "pthread_condattr_t *attr" "clockid_t clock"
74.Ft int
75.Fn pthread_condattr_destroy "pthread_condattr_t *attr"
76.Ft int
77.Fn pthread_condattr_getpshared "const pthread_condattr_t * __restrict attr" "int * __restrict pshared"
78.Ft int
79.Fn pshared_condattr_setpshared "pthread_condattr_t *attr" "int pshared"
80.Sh DESCRIPTION
81Condition attribute objects are used to specify parameters to the
82.Xr pthread_cond_init 3
83function.
84The
85.Fn pthread_condattr_init
86function initializes a condition attribute object with the default attributes
87and the
88.Fn pthread_condattr_destroy
89function destroys a condition attribute object.
90The
91.Fn pthread_condattr_getclock
92function shall obtain the value of the
93.Fa clock
94attributes object referenced by
95.Fa attr .
96The
97.Fn pthread_condattr_setclock
98function sets the system clock to be used for time comparisons to
99the one specified in
100.Fa clock .
101Valid clock values are
102.Dv CLOCK_MONOTONIC
103and
104.Dv CLOCK_REALTIME
105(the default).
106The
107.Fn pthread_condattr_getpshared
108function shall obtain the value of the process-shared attribute from the
109attributes object referenced by
110.Fa attr .
111The
112.Fn pthread_condattr_setpshared
113function shall set the process-shared attribute in an initialized attributes
114object referenced by
115.Fa attr .
116.Sh RETURN VALUES
117If successful, these functions return 0.
118Otherwise, an error number is returned to indicate the error.
119.Sh ERRORS
120No errors are defined for
121.Fn pthread_condattr_init .
122.Pp
123The
124.Fn pthread_condattr_destroy
125function may fail if:
126.Bl -tag -width Er
127.It Bq Er EINVAL
128The value specified by
129.Fa attr
130is invalid.
131.El
132.Pp
133The
134.Fn pthread_condattr_getclock
135and
136.Fn pthread_condattr_setclock
137may fail if:
138.Bl -tag -width Er
139.It Bq Er EINVAL
140The value specified by
141.Fa attr
142is invalid.
143.El
144.Pp
145The
146.Fn pthread_condattr_getpshared
147and
148.Fn pthread_condattr_setpshared
149may fail if:
150.Bl -tag -width Er
151.It Bq Er EINVAL
152The value specified by
153.Fa attr
154is invalid.
155.El
156.Sh SEE ALSO
157.Xr pthread_cond_init 3
158.Sh STANDARDS
159Both functions conform to
160.St -p1003.1-2001 .
161.Sh BUGS
162The
163.Fn pthread_condattr_getpshared
164and
165.Fn pthread_condattr_setpshared
166functions are hidden by default since only thread shared attributes
167are supported.
168