pthread_condattr.3 (3e9ed1efb85a632c2b4bee70f3ae37a464aba6ad) pthread_condattr.3 (febae919acc32d22fc918adf6e3750c37d5dc9b1)
1.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 12 unchanged lines hidden (view full) ---

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.
27.\"
28.\" $FreeBSD$
1.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 12 unchanged lines hidden (view full) ---

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.
27.\"
28.\" $FreeBSD$
29.Dd April 28, 2000
29.Dd May 9, 2010
30.Dt PTHREAD_CONDATTR 3
31.Os
32.Sh NAME
33.Nm pthread_condattr_init ,
30.Dt PTHREAD_CONDATTR 3
31.Os
32.Sh NAME
33.Nm pthread_condattr_init ,
34.Nm pthread_condattr_destroy
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 ,
35.Nd condition attribute operations
36.Sh LIBRARY
37.Lb libpthread
38.Sh SYNOPSIS
39.In pthread.h
40.Ft int
41.Fn pthread_condattr_init "pthread_condattr_t *attr"
42.Ft int
43.Fn pthread_condattr_destroy "pthread_condattr_t *attr"
39.Nd condition attribute operations
40.Sh LIBRARY
41.Lb libpthread
42.Sh SYNOPSIS
43.In pthread.h
44.Ft int
45.Fn pthread_condattr_init "pthread_condattr_t *attr"
46.Ft int
47.Fn pthread_condattr_destroy "pthread_condattr_t *attr"
48.Ft int
49.Fn pthread_condattr_getclock "pthread_condattr_t * restrict attr" "clock_t * restrict clock_id"
50.Ft int
51.Fn pthread_condattr_setclock "pthread_condattr_t *attr" "clock_t clock_id"
52.Ft int
53.Fn pthread_condattr_getpshared "pthread_condattr_t * restrict attr" "int * restrict pshared"
54.Ft int
55.Fn pthread_condattr_setpshared "pthread_condattr_t *attr" "int pshared"
44.Sh DESCRIPTION
45Condition attribute objects are used to specify parameters to
46.Fn pthread_cond_init .
56.Sh DESCRIPTION
57Condition attribute objects are used to specify parameters to
58.Fn pthread_cond_init .
47.Fx Ns 's
48implementation of conditions does not support any non-default
49attributes, so these functions are not very useful, though they are required
50to be present by
51.Tn POSIX .
52.Pp
53The
54.Fn pthread_condattr_init
55function initializes a condition attribute object with the default attributes.
56.Pp
57The
58.Fn pthread_condattr_destroy
59function destroys a condition attribute object.
59.Pp
60The
61.Fn pthread_condattr_init
62function initializes a condition attribute object with the default attributes.
63.Pp
64The
65.Fn pthread_condattr_destroy
66function destroys a condition attribute object.
67.Pp
68The
69.Fn pthread_condattr_getclock
70function will put the value of the clock attribute from
71.Fa attr
72into the memory area pointed to by
73.Fa clock_id .
74The
75.Fn pthread_condattr_setclock
76function will set the clock attribute of
77.Fa attr
78to the value specified in
79.Fa clock_id .
80The clock attribute affects the interpretation of
81.Fa abstime
82in
83.Xr pthread_cond_timedwait 3
84and may be set to
85.Dv CLOCK_REALTIME
86(default)
87or
88.Dv CLOCK_MONOTONIC .
89.Pp
90The
91.Fn pthread_condattr_getpshared
92function will put the value of the process-shared attribute from
93.Fa attr
94into the memory area pointed to by
95.Fa pshared .
96The
97.Fn pthread_condattr_setpshared
98function will set the process-shared attribute of
99.Fa attr
100to the value specified in
101.Fa pshared .
102The argument
103.Fa pshared
104may have one of the following values:
105.Bl -tag -width ".Dv PTHREAD_PROCESS_PRIVATE"
106.It Dv PTHREAD_PROCESS_PRIVATE
107The condition variable it is attached to may only be accessed by
108threads in the same process as the one that created the object.
109.It Dv PTHREAD_PROCESS_SHARED
110The condition variable it is attached to may be accessed by
111threads in processes other than the one that created the object.
112.El
60.Sh RETURN VALUES
61If successful, these functions return 0.
62Otherwise, an error number is returned to indicate the error.
63.Sh ERRORS
64The
65.Fn pthread_condattr_init
66function will fail if:
67.Bl -tag -width Er

--- 4 unchanged lines hidden (view full) ---

72The
73.Fn pthread_condattr_destroy
74function will fail if:
75.Bl -tag -width Er
76.It Bq Er EINVAL
77Invalid value for
78.Fa attr .
79.El
113.Sh RETURN VALUES
114If successful, these functions return 0.
115Otherwise, an error number is returned to indicate the error.
116.Sh ERRORS
117The
118.Fn pthread_condattr_init
119function will fail if:
120.Bl -tag -width Er

--- 4 unchanged lines hidden (view full) ---

125The
126.Fn pthread_condattr_destroy
127function will fail if:
128.Bl -tag -width Er
129.It Bq Er EINVAL
130Invalid value for
131.Fa attr .
132.El
133.Pp
134The
135.Fn pthread_condattr_setclock
136function will fail if:
137.Bl -tag -width Er
138.It Bq Er EINVAL
139The value specified in
140.Fa clock_id
141is not one of the allowed values.
142.El
143.Pp
144The
145.Fn pthread_condattr_setpshared
146function will fail if:
147.Bl -tag -width Er
148.It Bq Er EINVAL
149The value specified in
150.Fa pshared
151is not one of the allowed values.
152.El
80.Sh SEE ALSO
153.Sh SEE ALSO
81.Xr pthread_cond_init 3
154.Xr pthread_cond_init 3 ,
155.Xr pthread_cond_timedwait 3
82.Sh STANDARDS
83The
84.Fn pthread_condattr_init
85and
86.Fn pthread_condattr_destroy
87functions conform to
88.St -p1003.1-96
156.Sh STANDARDS
157The
158.Fn pthread_condattr_init
159and
160.Fn pthread_condattr_destroy
161functions conform to
162.St -p1003.1-96
163.Sh BUGS
164The implementation of
165condition variables
166does not fully conform to
167.St -p1003.2
168because the process-shared attribute is ignored;
169if any value other than
170.Dv PTHREAD_PROCESSES_PRIVATE
171is specified in a call to
172.Fn pthread_condattr_setpshared ,
173it will return
174.Er EINVAL .