Print this page
11622 clean up rarer mandoc lint warnings
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man5/threads.5
+++ new/usr/src/man/man5/threads.5
1 1 '\" te
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
2 2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 3 .\" Copyright 2016 Joyent, Inc.
4 4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 7 .TH THREADS 5 "Mar 27, 2016"
8 8 .SH NAME
9 9 threads, pthreads \- POSIX pthreads, c11, and illumos threads concepts
10 10 .SH SYNOPSIS
11 11 .SS "POSIX"
12 -.LP
13 12 .nf
14 13 gcc -D_REENTRANT [ \fIflag\fR... ] \fIfile\fR... [ \fIlibrary\fR... ]
15 14 .fi
16 15
17 16 .LP
18 17 .nf
19 18 #include <pthread.h>
20 19 .fi
21 20
22 21 .SS "C11"
23 -.LP
24 22 .nf
25 23 gcc -std=c11 -D_REENTRANT [ \fIflag\fR... ] \fIfile\fR... [ \fIlibrary\fR... ]
26 24 .fi
27 25
28 26 .LP
29 27 .nf
30 28 #include <threads.h>
31 29 .fi
32 30
33 31 .SS "illumos"
34 -.LP
35 32 .nf
36 33 gcc -D_REENTRANT [ \fIflag\fR... ] \fIfile\fR... [ \fIlibrary\fR... ]
37 34 .fi
38 35
39 36 .LP
40 37 .nf
41 38 #include <sched.h>
42 39 .fi
43 40
44 41 .LP
45 42 .nf
46 43 #include <thread.h>
47 44 .fi
48 45
49 46 .SH DESCRIPTION
50 -.LP
51 47 A thread is an independent source of execution within a process. Every process
52 48 is created with a single thread, which calls the
53 49 .B main
54 50 function. A process may have multiple threads, all of which are scheduled
55 51 independently by the system and may run concurrently. Threads within a process
56 52 all use the same address space and as a result can access all data in the
57 53 process; however, each thread is created with its own attributes and its own
58 54 stack. When a thread is created, it inherits the signal mask of the thread which
59 55 created it, but it has no pending signals.
60 56 .sp
61 57 .LP
62 58 All threads of execution have their own, independent life time, though it is
63 59 ultimately bounded by the life time of the process. If the process terminates
64 60 for any reason, whether due to a call to \fBexit\fR(3C), the receipt of a fatal
65 61 signal, or some other reason, then all threads within the process are
66 62 terminated. Threads may themselves exit and status information of them may be
67 63 obtained, for more information, see the \fBpthread_detach\fR(3C),
68 64 \fBpthread_join\fR(3C), and \fBpthread_exit\fR(3C) functions, and their
69 65 equivalents as described in the tables later on in the manual.
70 66 .sp
71 67 .LP
72 68 Most hardware platforms do not have any special synchronization for data objects
73 69 which may be accessed concurrently from multiple threads of execution. To avoid
74 70 such problems, programs may use atomic operations (see \fBatomic_ops\fR(3C)) and
75 71 locking primitives, such as mutexes, readers/writer locks, condition variables,
76 72 and semaphores. Note, that depending on the hardware platform, memory
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
77 73 synchronization may be necessary, for more information, see \fBmembar_ops\fR(3C).
78 74 .LP
79 75 POSIX, C11, and illumos threads each have their own implementation within
80 76 \fBlibc\fR(3LIB). All implementations are interoperable, their functionality
81 77 similar, and can be used within the same application. Only POSIX threads are
82 78 guaranteed to be fully portable to other POSIX-compliant environments. C11
83 79 threads are an optional part of ISO C11 and may not exist on every ISO C11
84 80 platform. POSIX, C11, and illumos threads require different source and include
85 81 files. See \fBSYNOPSIS\fR.
86 82 .SS "Similarities"
87 -.LP
88 83 Most of the POSIX and illumos threading functions have counterparts with each
89 84 other. POSIX function names, with the exception of the semaphore names, have a
90 85 "\fBpthread\fR" prefix. Function names for similar POSIX and illumos functions
91 86 have similar endings. Typically, similar POSIX and illumos functions have the
92 87 same number and use of arguments.
93 88 .SS "Differences"
94 -.LP
95 89 POSIX pthreads and illumos threads differ in the following ways:
96 90 .RS +4
97 91 .TP
98 92 .ie t \(bu
99 93 .el o
100 94 POSIX threads are more portable.
101 95 .RE
102 96 .RS +4
103 97 .TP
104 98 .ie t \(bu
105 99 .el o
106 100 POSIX threads establish characteristics for each thread according to
107 101 configurable attribute objects.
108 102 .RE
109 103 .RS +4
110 104 .TP
111 105 .ie t \(bu
112 106 .el o
113 107 POSIX pthreads implement thread cancellation.
114 108 .RE
115 109 .RS +4
116 110 .TP
117 111 .ie t \(bu
118 112 .el o
119 113 POSIX pthreads enforce scheduling algorithms.
120 114 .RE
121 115 .RS +4
122 116 .TP
123 117 .ie t \(bu
124 118 .el o
125 119 POSIX pthreads allow for clean-up handlers for \fBfork\fR(2) calls.
126 120 .RE
127 121 .RS +4
128 122 .TP
129 123 .ie t \(bu
130 124 .el o
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
131 125 illumos threads can be suspended and continued.
132 126 .RE
133 127 .RS +4
134 128 .TP
135 129 .ie t \(bu
136 130 .el o
137 131 illumos threads implement daemon threads, for whose demise the process does not
138 132 wait.
139 133 .RE
140 134 .SS "Comparison to C11 Threads"
141 -.LP
142 135 C11 threads are not as functional as either POSIX or illumos threads. C11
143 136 threads only support intra-process locking and do not have any form of
144 137 readers/writer locking or semaphores. In general, POSIX threads will be more
145 138 portable than C11 threads, all POSIX-compliant systems support pthreads;
146 139 however, not all C environments support C11 Threads.
147 140 .sp
148 141 .LP
149 142 In addition to lacking other common synchronization primitives, the ISO/IEC
150 143 standard for C11 threads does not have rich error semantics. In an effort to not
151 144 extend the set of error numbers standardized in ISO/IEC C11, none of the
152 145 routines set errno and instead multiple distinguishable errors, aside from the
153 146 equivalent to ENOMEM and EBUSY, are all squashed into one. As such, users of the
154 147 platform are encouraged to use POSIX threads, unless a portability concern
155 148 dictates otherwise.
156 149
157 150 .SH FUNCTION COMPARISON
158 -.LP
159 151 The following table compares the POSIX pthreads, C11 threads, and illumos
160 152 threads functions. When a comparable interface is not available either in POSIX
161 153 pthreads, C11 threads or illumos threads, a hyphen (\fB-\fR) appears in the
162 154 column.
163 155 .SS "Functions Related to Creation"
164 156
165 157 .TS
166 158 l l l
167 159 l l l .
168 160 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
169 161 \fBpthread_create()\fR \fBthr_create()\fR \fBthrd_create()\fR
170 162 \fBpthread_attr_init()\fR \fB-\fR \fB-\fR
171 163 \fBpthread_attr_setdetachstate()\fR \fB-\fR \fB-\fR
172 164 \fBpthread_attr_getdetachstate()\fR \fB-\fR \fB-\fR
173 165 \fBpthread_attr_setinheritsched()\fR \fB-\fR \fB-\fR
174 166 \fBpthread_attr_getinheritsched()\fR \fB-\fR \fB-\fR
175 167 \fBpthread_attr_setschedparam()\fR \fB-\fR \fB-\fR
176 168 \fBpthread_attr_getschedparam()\fR \fB-\fR \fB-\fR
177 169 \fBpthread_attr_setschedpolicy()\fR \fB-\fR \fB-\fR
178 170 \fBpthread_attr_getschedpolicy()\fR \fB-\fR \fB-\fR
179 171 \fBpthread_attr_setscope()\fR \fB-\fR \fB-\fR
180 172 \fBpthread_attr_getscope()\fR \fB-\fR \fB-\fR
181 173 \fBpthread_attr_setstackaddr()\fR \fB-\fR \fB-\fR
182 174 \fBpthread_attr_getstackaddr()\fR \fB-\fR \fB-\fR
183 175 \fBpthread_attr_setstacksize()\fR \fB-\fR \fB-\fR
184 176 \fBpthread_attr_getstacksize()\fR \fB-\fR \fB-\fR
185 177 \fBpthread_attr_getguardsize()\fR \fB-\fR \fB-\fR
186 178 \fBpthread_attr_setguardsize()\fR \fB-\fR \fB-\fR
187 179 \fBpthread_attr_destroy()\fR \fB-\fR \fB-\fR
188 180 \fB-\fR \fBthr_min_stack()\fR \fB-\fR
189 181 .TE
190 182
191 183 .SS "Functions Related to Exit"
192 184
193 185 .TS
194 186 l l l
195 187 l l l .
196 188 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
197 189 \fBpthread_exit()\fR \fBthr_exit()\fR \fBthrd_exit()\fR
198 190 \fBpthread_join()\fR \fBthr_join()\fR \fBthrd_join()\fR
199 191 \fBpthread_detach()\fR \fB-\fR \fBthrd_detach()\fR
200 192 .TE
201 193
202 194 .SS "Functions Related to Thread Specific Data"
203 195
204 196 .TS
205 197 l l l
206 198 l l l .
207 199 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
208 200 \fBpthread_key_create()\fR \fBthr_keycreate()\fR \fBtss_create()\fR
209 201 \fBpthread_setspecific()\fR \fBthr_setspecific()\fR \fBtss_set()\fR
210 202 \fBpthread_getspecific()\fR \fBthr_getspecific()\fR \fBtss_get()\fR
211 203 \fBpthread_key_delete()\fR \fB-\fR \fBtss_delete()\fR
212 204 .TE
213 205
214 206 .SS "Functions Related to Signals"
215 207
216 208 .TS
217 209 l l l
218 210 l l l .
219 211 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
220 212 \fBpthread_sigmask()\fR \fBthr_sigsetmask()\fR \fB-\fR
221 213 \fBpthread_kill()\fR \fBthr_kill()\fR \fB-\fR
222 214 .TE
223 215
224 216 .SS "Functions Related to IDs"
225 217
226 218 .TS
227 219 l l l
228 220 l l l .
229 221 \fBPOSIX\fR \fBillumos\fR \fBc11\fR
230 222 \fBpthread_self()\fR \fBthr_self()\fR \fBthrd_current()\fR
231 223 \fBpthread_equal()\fR \fB-\fR \fBthrd_equal()\fR
232 224 \fB-\fR \fBthr_main()\fR \fB-\fR
233 225 .TE
234 226
235 227 .SS "Functions Related to Scheduling"
236 228
237 229 .TS
238 230 l l l
239 231 l l l .
240 232 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
241 233 \fB-\fR \fBthr_yield()\fR \fBthrd_yield()\fR
242 234 \fB-\fR \fBthr_suspend()\fR \fB-\fR
243 235 \fB-\fR \fBthr_continue()\fR \fB-\fR
244 236 \fBpthread_setconcurrency()\fR \fBthr_setconcurrency()\fR \fB-\fR
245 237 \fBpthread_getconcurrency()\fR \fBthr_getconcurrency()\fR \fB-\fR
246 238 \fBpthread_setschedparam()\fR \fBthr_setprio()\fR \fB-\fR
247 239 \fBpthread_setschedprio()\fR \fBthr_setprio()\fR \fB-\fR
248 240 \fBpthread_getschedparam()\fR \fBthr_getprio()\fR \fB-\fR
249 241 .TE
250 242
251 243 .SS "Functions Related to Cancellation"
252 244
253 245 .TS
254 246 l l l
255 247 l l l .
256 248 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
257 249 \fBpthread_cancel()\fR \fB-\fR \fB-\fR
258 250 \fBpthread_setcancelstate()\fR \fB-\fR \fB-\fR
259 251 \fBpthread_setcanceltype()\fR \fB-\fR \fB-\fR
260 252 \fBpthread_testcancel()\fR \fB-\fR \fB-\fR
261 253 \fBpthread_cleanup_pop()\fR \fB-\fR \fB-\fR
262 254 \fBpthread_cleanup_push()\fR \fB-\fR \fB-\fR
263 255 .TE
264 256
265 257 .SS "Functions Related to Mutexes"
266 258
267 259 .TS
268 260 l l l
269 261 l l l .
270 262 \fBPOSIX\fR \fBillumos\fR \fBc11\fR
271 263 \fBpthread_mutex_init()\fR \fBmutex_init()\fR \fBmtx_init()\fR
272 264 \fBpthread_mutexattr_init()\fR \fB-\fR \fB-\fR
273 265 \fBpthread_mutexattr_setpshared()\fR \fB-\fR \fB-\fR
274 266 \fBpthread_mutexattr_getpshared()\fR \fB-\fR \fB-\fR
275 267 \fBpthread_mutexattr_setprotocol()\fR \fB-\fR \fB-\fR
276 268 \fBpthread_mutexattr_getprotocol()\fR \fB-\fR \fB-\fR
277 269 \fBpthread_mutexattr_setprioceiling()\fR \fB-\fR \fB-\fR
278 270 \fBpthread_mutexattr_getprioceiling()\fR \fB-\fR \fB-\fR
279 271 \fBpthread_mutexattr_settype()\fR \fB-\fR \fB-\fR
280 272 \fBpthread_mutexattr_gettype()\fR \fB-\fR \fB-\fR
281 273 \fBpthread_mutexattr_setrobust()\fR \fB-\fR \fB-\fR
282 274 \fBpthread_mutexattr_getrobust()\fR \fB-\fR \fB-\fR
283 275 \fBpthread_mutexattr_destroy()\fR \fB-\fR \fBmtx_destroy()\fR
284 276 \fBpthread_mutex_setprioceiling()\fR \fB-\fR \fB-\fR
285 277 \fBpthread_mutex_getprioceiling()\fR \fB-\fR \fB-\fR
286 278 \fBpthread_mutex_lock()\fR \fBmutex_lock()\fR \fBmtx_lock()\fR
287 279 \fBpthread_mutex_timedlock()\fR \fB-\fR \fBmtx_timedlock()\fR
288 280 \fBpthread_mutex_trylock()\fR \fBmutex_trylock()\fR \fBmtx_trylock()\fR
289 281 \fBpthread_mutex_unlock()\fR \fBmutex_unlock()\fR \fBmtx_unlock()\fR
290 282 \fBpthread_mutex_destroy()\fR \fBmutex_destroy()\fR \fBmtx_destroy()\fR
291 283 .TE
292 284
293 285 .SS "Functions Related to Condition Variables"
294 286
295 287 .TS
296 288 l l l
297 289 l l l .
298 290 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
299 291 \fBpthread_cond_init()\fR \fBcond_init()\fR \fBcnd_init()\fR
300 292 \fBpthread_condattr_init()\fR \fB-\fR \fB-\fR
301 293 \fBpthread_condattr_setpshared()\fR \fB-\fR \fB-\fR
302 294 \fBpthread_condattr_getpshared()\fR \fB-\fR \fB-\fR
303 295 \fBpthread_condattr_destroy()\fR \fB-\fR \fB-\fR
304 296 \fBpthread_cond_wait()\fR \fBcond_wait()\fR \fBcnd_wait()\fR
305 297 \fBpthread_cond_timedwait()\fR \fBcond_timedwait()\fR \fBcond_timedwait()\fR
306 298 \fBpthread_cond_signal()\fR \fBcond_signal()\fR \fBcnd_signal()\fR
307 299 \fBpthread_cond_broadcast()\fR \fBcond_broadcast()\fR \fBcnd_broadcast()\fR
308 300 \fBpthread_cond_destroy()\fR \fBcond_destroy()\fR \fBcnd_destroy()\fR
309 301 .TE
310 302
311 303 .SS "Functions Related to Reader/Writer Locking"
312 304
313 305 .TS
314 306 l l l
315 307 l l l .
316 308 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
317 309 \fBpthread_rwlock_init()\fR \fBrwlock_init()\fR \fB-\fR
318 310 \fBpthread_rwlock_rdlock()\fR \fBrw_rdlock()\fR \fB-\fR
319 311 \fBpthread_rwlock_tryrdlock()\fR \fBrw_tryrdlock()\fR \fB-\fR
320 312 \fBpthread_rwlock_wrlock()\fR \fBrw_wrlock()\fR \fB-\fR
321 313 \fBpthread_rwlock_trywrlock()\fR \fBrw_trywrlock()\fR \fB-\fR
322 314 \fBpthread_rwlock_unlock()\fR \fBrw_unlock()\fR \fB-\fR
323 315 \fBpthread_rwlock_destroy()\fR \fBrwlock_destroy()\fR \fB-\fR
324 316 \fBpthread_rwlockattr_init()\fR \fB-\fR \fB-\fR
325 317 \fBpthread_rwlockattr_destroy()\fR \fB-\fR \fB-\fR
326 318 \fBpthread_rwlockattr_getpshared()\fR \fB-\fR \fB-\fR
327 319 \fBpthread_rwlockattr_setpshared()\fR \fB-\fR \fB-\fR
328 320 .TE
↓ open down ↓ |
160 lines elided |
↑ open up ↑ |
329 321
330 322 .SS "Functions Related to Semaphores"
331 323
332 324 .TS
333 325 l l l
334 326 l l l .
335 327 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
336 328 \fBsem_init()\fR \fBsema_init()\fR \fB-\fR
337 329 \fBsem_open()\fR \fB-\fR \fB-\fR
338 330 \fBsem_close()\fR \fB-\fR \fB-\fR
339 -\fBsem_wait()\fR \fBsema_wait()\ \fB-\fR
331 +\fBsem_wait()\fR \fBsema_wait()\fR \fB-\fR
340 332 \fBsem_trywait()\fR \fBsema_trywait()\fR \fB-\fR
341 333 \fBsem_post()\fR \fBsema_post()\fR \fB-\fR
342 334 \fBsem_getvalue()\fR \fB-\fR \fB-\fR
343 335 \fBsem_unlink()\fR \fB-\fR \fB-\fR
344 336 \fBsem_destroy()\fR \fBsema_destroy()\fR \fB-\fR
345 337 .TE
346 338
347 339 .SS "Functions Related to fork(\|) Clean Up"
348 340
349 341 .TS
350 342 l l l
351 343 l l l .
352 344 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
353 345 \fBpthread_atfork()\fR \fB-\fR \fB-\fR
354 346 .TE
355 347
356 348 .SS "Functions Related to Limits"
357 349
358 350 .TS
359 351 l l l
360 352 l l l .
361 353 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
362 354 \fBpthread_once()\fR \fB-\fR \fBcall_once()\fR
363 355 .TE
364 356
365 357 .SS "Functions Related to Debugging"
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
366 358
367 359 .TS
368 360 l l l
369 361 l l l .
370 362 \fBPOSIX\fR \fBillumos\fR \fBC11\fR
371 363 \fB-\fR \fBthr_stksegment()\fR \fB-\fR
372 364 .TE
373 365
374 366 .SH LOCKING
375 367 .SS "Synchronization"
376 -.LP
377 368 Multithreaded behavior is asynchronous, and therefore, optimized for
378 369 concurrent and parallel processing. As threads, always from within the same
379 370 process and sometimes from multiple processes, share global data with each
380 371 other, they are not guaranteed exclusive access to the shared data at any point
381 372 in time. Securing mutually exclusive access to shared data requires
382 373 synchronization among the threads. Both POSIX and illumos implement four
383 374 synchronization mechanisms: mutexes, condition variables, reader/writer locking
384 375 (\fIoptimized frequent-read occasional-write mutex\fR), and semaphores, where as
385 376 C11 threads only implement two mechanisms: mutexes and condition variables.
386 377 .sp
387 378 .LP
388 379 Synchronizing multiple threads diminishes their concurrency. The coarser the
389 380 grain of synchronization, that is, the larger the block of code that is locked,
390 381 the lesser the concurrency.
391 382 .SS "MT \fBfork()\fR"
392 -.LP
393 383 If a threads program calls \fBfork\fR(2), it implicitly calls \fBfork1\fR(2),
394 384 which replicates only the calling thread. Should there be any outstanding
395 385 mutexes throughout the process, the application should call
396 386 \fBpthread_atfork\fR(3C) to wait for and acquire those mutexes prior to calling
397 387 \fBfork()\fR.
398 388 .SH SCHEDULING
399 389 .SS "POSIX Threads"
400 -.LP
401 390 illumos supports the following three POSIX scheduling policies:
402 391 .sp
403 392 .ne 2
404 393 .na
405 394 \fB\fBSCHED_OTHER\fR\fR
406 395 .ad
407 396 .RS 15n
408 397 Traditional Timesharing scheduling policy. It is based on the timesharing (TS)
409 398 scheduling class.
410 399 .RE
411 400
412 401 .sp
413 402 .ne 2
414 403 .na
415 404 \fB\fBSCHED_FIFO\fR\fR
416 405 .ad
417 406 .RS 15n
418 407 First-In-First-Out scheduling policy. Threads scheduled to this policy, if not
419 408 preempted by a higher priority, will proceed until completion. Such threads are
420 409 in real-time (RT) scheduling class. The calling process must have a effective
421 410 user \fBID\fR of \fB0\fR.
422 411 .RE
423 412
424 413 .sp
425 414 .ne 2
426 415 .na
427 416 \fB\fBSCHED_RR\fR\fR
428 417 .ad
429 418 .RS 15n
430 419 Round-Robin scheduling policy. Threads scheduled to this policy, if not
431 420 preempted by a higher priority, will execute for a time period determined by
432 421 the system. Such threads are in real-time (RT) scheduling class and the calling
433 422 process must have a effective user \fBID\fR of \fB0\fR.
434 423 .RE
435 424
436 425 .sp
437 426 .LP
438 427 In addition to the POSIX-specified scheduling policies above, illumos also
439 428 supports these scheduling policies:
440 429 .sp
441 430 .ne 2
442 431 .na
443 432 \fB\fBSCHED_IA\fR\fR
444 433 .ad
445 434 .RS 13n
446 435 Threads are scheduled according to the Inter-Active Class (IA) policy as
447 436 described in \fBpriocntl\fR(2).
448 437 .RE
449 438
450 439 .sp
451 440 .ne 2
452 441 .na
453 442 \fB\fBSCHED_FSS\fR\fR
454 443 .ad
455 444 .RS 13n
456 445 Threads are scheduled according to the Fair-Share Class (FSS) policy as
457 446 described in \fBpriocntl\fR(2).
458 447 .RE
459 448
460 449 .sp
↓ open down ↓ |
50 lines elided |
↑ open up ↑ |
461 450 .ne 2
462 451 .na
463 452 \fB\fBSCHED_FX\fR\fR
464 453 .ad
465 454 .RS 13n
466 455 Threads are scheduled according to the Fixed-Priority Class (FX) policy as
467 456 described in \fBpriocntl\fR(2).
468 457 .RE
469 458
470 459 .SS "illumos Threads"
471 -.LP
472 460 Only scheduling policy supported is \fBSCHED_OTHER\fR, which is timesharing,
473 461 based on the \fBTS\fR scheduling class.
474 462 .SH ERRORS
475 -.LP
476 463 In a multithreaded application, \fBEINTR\fR can be returned from blocking
477 464 system calls when another thread calls \fBforkall\fR(2).
478 465 .SH USAGE
479 466 .SS "\fB-mt\fR compiler option"
480 -.LP
481 467 The \fB-mt\fR compiler option compiles and links for multithreaded code. It
482 468 compiles source files with \(mi\fBD_REENTRANT\fR and augments the set of
483 469 support libraries properly.
484 470 .sp
485 471 .LP
486 472 Users of other compilers such as gcc and clang should manually set
487 473 \(mi\fBD_REENTRANT\fR on the compilation line. There are no other libraries or
488 474 flags necessary.
489 475 .SH ATTRIBUTES
490 -.LP
491 476 See \fBattributes\fR(5) for descriptions of the following attributes:
492 477 .sp
493 478
494 479 .sp
495 480 .TS
496 481 box;
497 482 c | c
498 483 l | l .
499 484 ATTRIBUTE TYPE ATTRIBUTE VALUE
500 485 _
501 486 MT-Level MT-Safe, Fork 1-Safe
502 487 .TE
503 488
504 489 .SH SEE ALSO
505 -.LP
506 490 \fBcrle\fR(1), \fBfork\fR(2), \fBpriocntl\fR(2), \fBlibpthread\fR(3LIB),
507 491 \fBlibrt\fR(3LIB), \fBlibthread\fR(3LIB), \fBpthread_atfork\fR(3C),
508 492 \fBpthread_create\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)
509 493 .sp
510 494 .LP
511 495 \fILinker and Libraries Guide\fR
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX