1 .\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice(s), this list of conditions and the following disclaimer as
9 .\" the first lines of this file unmodified other than the possible
10 .\" addition of one or more copyright notices.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice(s), this list of conditions and the following disclaimer in
13 .\" the documentation and/or other materials provided with the
16 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
17 .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
20 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 .Dt PTHREAD_CONDATTR 3
33 .Nm pthread_condattr_init ,
34 .Nm pthread_condattr_destroy ,
35 .Nm pthread_condattr_getclock ,
36 .Nm pthread_condattr_setclock ,
37 .Nm pthread_condattr_getpshared ,
38 .Nm pthread_condattr_setpshared
39 .Nd condition attribute operations
45 .Fn pthread_condattr_init "pthread_condattr_t *attr"
47 .Fn pthread_condattr_destroy "pthread_condattr_t *attr"
49 .Fn pthread_condattr_getclock "pthread_condattr_t * restrict attr" "clock_t * restrict clock_id"
51 .Fn pthread_condattr_setclock "pthread_condattr_t *attr" "clock_t clock_id"
53 .Fn pthread_condattr_getpshared "pthread_condattr_t * restrict attr" "int * restrict pshared"
55 .Fn pthread_condattr_setpshared "pthread_condattr_t *attr" "int pshared"
57 Condition attribute objects are used to specify parameters to
58 .Fn pthread_cond_init .
61 .Fn pthread_condattr_init
62 function initializes a condition attribute object with the default attributes.
65 .Fn pthread_condattr_destroy
66 function destroys a condition attribute object.
69 .Fn pthread_condattr_getclock
70 function will put the value of the clock attribute from
72 into the memory area pointed to by
75 .Fn pthread_condattr_setclock
76 function will set the clock attribute of
78 to the value specified in
80 The clock attribute affects the interpretation of
83 .Xr pthread_cond_timedwait 3
91 .Fn pthread_condattr_getpshared
92 function will put the value of the process-shared attribute from
94 into the memory area pointed to by
97 .Fn pthread_condattr_setpshared
98 function will set the process-shared attribute of
100 to the value specified in
104 may have one of the following values:
105 .Bl -tag -width ".Dv PTHREAD_PROCESS_PRIVATE"
106 .It Dv PTHREAD_PROCESS_PRIVATE
107 The condition variable it is attached to may only be accessed by
108 threads in the same process as the one that created the object.
109 .It Dv PTHREAD_PROCESS_SHARED
110 The condition variable it is attached to may be accessed by
111 threads in processes other than the one that created the object.
114 If successful, these functions return 0.
115 Otherwise, an error number is returned to indicate the error.
118 .Fn pthread_condattr_init
119 function will fail if:
126 .Fn pthread_condattr_destroy
127 function will fail if:
135 .Fn pthread_condattr_setclock
136 function will fail if:
139 The value specified in
141 is not one of the allowed values.
145 .Fn pthread_condattr_setpshared
146 function will fail if:
149 The value specified in
151 is not one of the allowed values.
154 .Xr pthread_cond_init 3 ,
155 .Xr pthread_cond_timedwait 3
158 .Fn pthread_condattr_init
160 .Fn pthread_condattr_destroy
164 The implementation of
166 does not fully conform to
168 because the process-shared attribute is ignored;
169 if any value other than
170 .Dv PTHREAD_PROCESSES_PRIVATE
171 is specified in a call to
172 .Fn pthread_condattr_setpshared ,