Print this page
12743 man page spelling mistakes
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man5/condition.5
+++ new/usr/src/man/man5/condition.5
1 1 .\"
2 2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 3 .\" permission to reproduce portions of its copyrighted documentation.
4 4 .\" Original documentation from The Open Group can be obtained online at
5 5 .\" http://www.opengroup.org/bookstore/.
6 6 .\"
7 7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 8 .\" Group, have given us permission to reprint portions of their
9 9 .\" documentation.
10 10 .\"
11 11 .\" In the following statement, the phrase ``this text'' refers to portions
12 12 .\" of the system documentation.
13 13 .\"
14 14 .\" Portions of this text are reprinted and reproduced in electronic form
15 15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 16 .\" Standard for Information Technology -- Portable Operating System
17 17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 20 .\" between these versions and the original IEEE and The Open Group
21 21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 22 .\" document. The original Standard can be obtained online at
23 23 .\" http://www.opengroup.org/unix/online.html.
24 24 .\"
25 25 .\" This notice shall appear on any product containing this material.
26 26 .\"
27 27 .\" The contents of this file are subject to the terms of the
28 28 .\" Common Development and Distribution License (the "License").
29 29 .\" You may not use this file except in compliance with the License.
30 30 .\"
31 31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 32 .\" or http://www.opensolaris.org/os/licensing.
33 33 .\" See the License for the specific language governing permissions
34 34 .\" and limitations under the License.
35 35 .\"
36 36 .\" When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
37 37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 38 .\" If applicable, add the following below this CDDL HEADER, with the
39 39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 41 .\"
42 42 .\"
43 43 .\" Portions Copyright (c) 1995 IEEE All Rights Reserved
44 44 .\" Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
45 45 .\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved.
46 46 .\"
47 -.TH CONDITION 5 "Jul 20, 1998"
47 +.TH CONDITION 5 "May 16, 2020"
48 48 .SH NAME
49 49 condition \- concepts related to condition variables
50 50 .SH DESCRIPTION
51 -.sp
52 -.LP
53 51 Occasionally, a thread running within a mutex needs to wait for an event, in
54 52 which case it blocks or sleeps. When a thread is waiting for another thread to
55 53 communicate its disposition, it uses a condition variable in conjunction with a
56 54 mutex. Although a mutex is exclusive and the code it protects is sharable (at
57 55 certain moments), condition variables enable the synchronization of differing
58 56 events that share a mutex, but not necessarily data. Several condition
59 57 variables may be used by threads to signal each other when a task is complete,
60 58 which then allows the next waiting thread to take ownership of the mutex.
61 59 .sp
62 60 .LP
63 61 A condition variable enables threads to atomically block and test the condition
64 62 under the protection of a mutual exclusion lock (mutex) until the condition is
65 63 satisfied. If the condition is false, a thread blocks on a condition variable
66 64 and atomically releases the mutex that is waiting for the condition to change.
67 65 If another thread changes the condition, it may wake up waiting threads by
68 66 signaling the associated condition variable. The waiting threads, upon
69 67 awakening, reacquire the mutex and re-evaluate the condition.
70 68 .SS "Initialize"
71 -.sp
72 -.LP
73 69 Condition variables and mutexes should be global. Condition variables that are
74 70 allocated in writable memory can synchronize threads among processes if they
75 71 are shared by the cooperating processes (see \fBmmap\fR(2)) and are initialized
76 72 for this purpose.
77 73 .sp
78 74 .LP
79 75 The scope of a condition variable is either intra-process or inter-process.
80 76 This is dependent upon whether the argument is passed implicitly or explicitly
81 77 to the initialization of that condition variable. A condition variable does
82 78 not need to be explicitly initialized. A condition variable is initialized with
83 79 all zeros, by default, and its scope is set to within the calling process. For
84 80 inter-process synchronization, a condition variable must be initialized once,
85 81 and only once, before use.
86 82 .sp
87 83 .LP
88 84 A condition variable must not be simultaneously initialized by multiple threads
89 85 or re-initialized while in use by other threads.
90 86 .sp
91 87 .LP
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
92 88 Condition variables attributes may be set to the default or customized at
93 89 initialization. POSIX threads even allow the default values to be customized.
94 90 Establishing these attributes varies depending upon whether POSIX or Solaris
95 91 threads are used. Similar to the distinctions between POSIX and Solaris thread
96 92 creation, POSIX condition variables implement the default, intra-process,
97 93 unless an attribute object is modified for inter-process prior to the
98 94 initialization of the condition variable. Solaris condition variables also
99 95 implement as the default, intra-process; however, they set this attribute
100 96 according to the argument, \fItype\fR, passed to their initialization function.
101 97 .SS "Condition Wait"
102 -.sp
103 -.LP
104 98 The condition wait interface allows a thread to wait for a condition and
105 99 atomically release the associated mutex that it needs to hold to check the
106 100 condition. The thread waits for another thread to make the condition true and
107 101 that thread's resulting call to signal and wakeup the waiting thread.
108 102 .SS "Condition Signaling"
109 -.sp
110 -.LP
111 103 A condition signal allows a thread to unblock the next thread waiting on the
112 104 condition variable, whereas, a condition broadcast allows a thread to unblock
113 105 all threads waiting on the condition variable.
114 106 .SS "Destroy"
115 -.sp
116 -.LP
117 107 The condition destroy functions destroy any state, but not the space,
118 108 associated with the condition variable.
119 109 .SH ATTRIBUTES
120 -.sp
121 -.LP
122 110 See \fBattributes\fR(5) for descriptions of the following attributes:
123 111 .sp
124 112
125 113 .sp
126 114 .TS
127 115 box;
128 116 c | c
129 117 l | l .
130 118 ATTRIBUTE TYPE ATTRIBUTE VALUE
131 119 _
132 120 MT-Level MT-Safe
133 121 .TE
134 122
135 123 .SH SEE ALSO
136 -.sp
137 -.LP
138 124 \fBfork\fR(2), \fBmmap\fR(2), \fBsetitimer\fR(2), \fBshmop\fR(2),
139 125 \fBcond_broadcast\fR(3C), \fBcond_destroy\fR(3C), \fBcond_init\fR(3C),
140 126 \fBcond_signal\fR(3C), \fBcond_timedwait\fR(3C), \fBcond_wait\fR(3C),
141 127 \fBpthread_cond_broadcast\fR(3C), \fBpthread_cond_destroy\fR(3C),
142 128 \fBpthread_cond_init\fR(3C), \fBpthread_cond_signal\fR(3C),
143 129 \fBpthread_cond_timedwait\fR(3C), \fBpthread_cond_wait\fR(3C),
144 130 \fBpthread_condattr_init\fR(3C), \fBsignal\fR(3C), \fBattributes\fR(5),
145 131 \fBmutex\fR(5), \fBstandards\fR(5)
146 132 .SH NOTES
147 -.sp
148 -.LP
149 133 If more than one thread is blocked on a condition variable, the order in which
150 134 threads are unblocked is determined by the scheduling policy.
151 135 .sp
152 136 .LP
153 -\fBUSYNC_THREAD\fR does not support multiple mapplings to the same logical
137 +\fBUSYNC_THREAD\fR does not support multiple mappings to the same logical
154 138 synch object. If you need to \fBmmap()\fR a synch object to different locations
155 139 within the same address space, then the synch object should be initialized as a
156 140 shared object \fBUSYNC_PROCESS\fR for Solaris, and
157 141 \fBPTHREAD_PROCESS_PRIVATE\fR for POSIX.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX