~ubuntu-branches/ubuntu/saucy/manpages/saucy

« back to all changes in this revision

Viewing changes to man7/pthreads.7

  • Committer: Bazaar Package Importer
  • Author(s): Joey Schulze
  • Date: 2008-11-29 12:01:13 UTC
  • mfrom: (1.1.36 upstream) (2.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20081129120113-7nufimylf2grlth8
* New upstream version
  . Fix description of range of function value return in atan2(3)
    (closes: Bug#506299)
  . Clarify and add more detail in RETURN VALUE description in
    getpwnam(3) and getgrnam(3) (closes: Bug#504787)
  . Add text on use of pointer arguments to makecontext(3) (closes:
    Bug#504699)
  . Document that LOG_KERN messages can't be generated from user
    processes in syslog(3)
* Avoid distribution of more pthread manpages that are currently also
  provided by glibc-doc:
  . pthread_attr_setinheritsched(3)
  . pthread_cancel(3)
  . pthread_cleanup_pop(3)
  . pthread_cleanup_push(3)
  . pthread_setcancelstate(3)
  . pthread_setcanceltype(3)
  . pthread_testcancel(3)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
.\" Formatted or processed versions of this manual, if unaccompanied by
22
22
.\" the source, must acknowledge the copyright and authors of this work.
23
23
.\"
24
 
.TH PTHREADS 7  2008-11-07 "Linux" "Linux Programmer's Manual"
 
24
.TH PTHREADS 7  2008-11-18 "Linux" "Linux Programmer's Manual"
25
25
.SH NAME
26
26
pthreads \- POSIX threads
27
27
.SH DESCRIPTION
132
132
(i.e., it will deliver the same results regardless of whether it is)
133
133
called from multiple threads at the same time.
134
134
 
135
 
POSIX.1-2001 requires that all functions specified in the standard
136
 
shall be thread-safe, except for the following functions:
 
135
POSIX.1-2001 and POSIX.1-2008 require that all functions specified
 
136
in the standard shall be thread-safe,
 
137
except for the following functions:
137
138
.in +4n
138
139
.nf
139
140
 
155
156
dirname()
156
157
dlerror()
157
158
drand48()
158
 
ecvt()
 
159
ecvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]
159
160
encrypt()
160
161
endgrent()
161
162
endpwent()
162
163
endutxent()
163
 
fcvt()
 
164
fcvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]
164
165
ftw()
165
 
gcvt()
 
166
gcvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]
166
167
getc_unlocked()
167
168
getchar_unlocked()
168
169
getdate()
170
171
getgrent()
171
172
getgrgid()
172
173
getgrnam()
173
 
gethostbyaddr()
174
 
gethostbyname()
 
174
gethostbyaddr() [POSIX.1-2001 only (function removed in POSIX.1-2008)]
 
175
gethostbyname() [POSIX.1-2001 only (function removed in POSIX.1-2008)]
175
176
gethostent()
176
177
getlogin()
177
178
getnetbyaddr()
218
219
setpwent()
219
220
setutxent()
220
221
strerror()
 
222
strsignal() [Added in POSIX.1-2008]
221
223
strtok()
 
224
system() [Added in POSIX.1-2008]
222
225
tmpnam() if passed a non-NULL argument
223
226
ttyname()
224
227
unsetenv()
228
231
wctomb()
229
232
.fi
230
233
.in
231
 
.PP
232
 
POSIX.1-2008 removes ecvt(), fcvt(), gcvt(), gethostbyname(),
233
 
and gethostbyaddr() from the above list
234
 
(because those functions are removed from the standard), and adds
235
 
strerror() and system().
 
234
.SS Cancellation Points
 
235
POSIX.1 specifies that certain functions must,
 
236
and certain other functions may, be cancellation points.
 
237
If a thread is cancelable, its cancelability type is deferred,
 
238
and a cancellation request is pending for the thread,
 
239
then the thread is canceled when it calls a function
 
240
that is a cancellation point.
 
241
 
 
242
The following functions are required to be cancellation points by
 
243
POSIX.1-2001 and/or POSIX.1-2008:
 
244
 
 
245
.\" FIXME
 
246
.\" Document the list of all functions that are cancellation points in glibc
 
247
.in +4n
 
248
.nf
 
249
accept()
 
250
aio_suspend()
 
251
clock_nanosleep()
 
252
close()
 
253
connect()
 
254
creat()
 
255
fcntl() F_SETLKW
 
256
fdatasync()
 
257
fsync()
 
258
getmsg()
 
259
getpmsg()
 
260
lockf() F_LOCK
 
261
mq_receive()
 
262
mq_send()
 
263
mq_timedreceive()
 
264
mq_timedsend()
 
265
msgrcv()
 
266
msgsnd()
 
267
msync()
 
268
nanosleep()
 
269
open()
 
270
openat() [Added in POSIX.1-2008]
 
271
pause()
 
272
poll()
 
273
pread()
 
274
pselect()
 
275
pthread_cond_timedwait()
 
276
pthread_cond_wait()
 
277
pthread_join()
 
278
pthread_testcancel()
 
279
putmsg()
 
280
putpmsg()
 
281
pwrite()
 
282
read()
 
283
readv()
 
284
recv()
 
285
recvfrom()
 
286
recvmsg()
 
287
select()
 
288
sem_timedwait()
 
289
sem_wait()
 
290
send()
 
291
sendmsg()
 
292
sendto()
 
293
sigpause() [POSIX.1-2001 only (moves to "may" list in POSIX.1-2008)]
 
294
sigsuspend()
 
295
sigtimedwait()
 
296
sigwait()
 
297
sigwaitinfo()
 
298
sleep()
 
299
system()
 
300
tcdrain()
 
301
usleep() [POSIX.1-2001 only (function removed in POSIX.1-2008)]
 
302
wait()
 
303
waitid()
 
304
waitpid()
 
305
write()
 
306
writev()
 
307
.fi
 
308
.in
 
309
 
 
310
The following functions may be cancellation points according to
 
311
POSIX.1-2001 and/or POSIX.1-2008:
 
312
 
 
313
.in +4n
 
314
.nf
 
315
access()
 
316
asctime()
 
317
asctime_r()
 
318
catclose()
 
319
catgets()
 
320
catopen()
 
321
chmod() [Added in POSIX.1-2008]
 
322
chown() [Added in POSIX.1-2008]
 
323
closedir()
 
324
closelog()
 
325
ctermid()
 
326
ctime()
 
327
ctime_r()
 
328
dbm_close()
 
329
dbm_delete()
 
330
dbm_fetch()
 
331
dbm_nextkey()
 
332
dbm_open()
 
333
dbm_store()
 
334
dlclose()
 
335
dlopen()
 
336
dprintf() [Added in POSIX.1-2008]
 
337
endgrent()
 
338
endhostent()
 
339
endnetent()
 
340
endprotoent()
 
341
endpwent()
 
342
endservent()
 
343
endutxent()
 
344
faccessat() [Added in POSIX.1-2008]
 
345
fchmod() [Added in POSIX.1-2008]
 
346
fchmodat() [Added in POSIX.1-2008]
 
347
fchown() [Added in POSIX.1-2008]
 
348
fchownat() [Added in POSIX.1-2008]
 
349
fclose()
 
350
fcntl() (for any value of cmd argument)
 
351
fflush()
 
352
fgetc()
 
353
fgetpos()
 
354
fgets()
 
355
fgetwc()
 
356
fgetws()
 
357
fmtmsg()
 
358
fopen()
 
359
fpathconf()
 
360
fprintf()
 
361
fputc()
 
362
fputs()
 
363
fputwc()
 
364
fputws()
 
365
fread()
 
366
freopen()
 
367
fscanf()
 
368
fseek()
 
369
fseeko()
 
370
fsetpos()
 
371
fstat()
 
372
fstatat() [Added in POSIX.1-2008]
 
373
ftell()
 
374
ftello()
 
375
ftw()
 
376
futimens() [Added in POSIX.1-2008]
 
377
fwprintf()
 
378
fwrite()
 
379
fwscanf()
 
380
getaddrinfo()
 
381
getc()
 
382
getc_unlocked()
 
383
getchar()
 
384
getchar_unlocked()
 
385
getcwd()
 
386
getdate()
 
387
getdelim() [Added in POSIX.1-2008]
 
388
getgrent()
 
389
getgrgid()
 
390
getgrgid_r()
 
391
getgrnam()
 
392
getgrnam_r()
 
393
gethostbyaddr() [SUSv3 only (function removed in POSIX.1-2008)]
 
394
gethostbyname() [SUSv3 only (function removed in POSIX.1-2008)]
 
395
gethostent()
 
396
gethostid()
 
397
gethostname()
 
398
getline() [Added in POSIX.1-2008]
 
399
getlogin()
 
400
getlogin_r()
 
401
getnameinfo()
 
402
getnetbyaddr()
 
403
getnetbyname()
 
404
getnetent()
 
405
getopt() (if opterr is non-zero)
 
406
getprotobyname()
 
407
getprotobynumber()
 
408
getprotoent()
 
409
getpwent()
 
410
getpwnam()
 
411
getpwnam_r()
 
412
getpwuid()
 
413
getpwuid_r()
 
414
gets()
 
415
getservbyname()
 
416
getservbyport()
 
417
getservent()
 
418
getutxent()
 
419
getutxid()
 
420
getutxline()
 
421
getwc()
 
422
getwchar()
 
423
getwd() [SUSv3 only (function removed in POSIX.1-2008)]
 
424
glob()
 
425
iconv_close()
 
426
iconv_open()
 
427
ioctl()
 
428
link()
 
429
linkat() [Added in POSIX.1-2008]
 
430
lio_listio() [Added in POSIX.1-2008]
 
431
localtime()
 
432
localtime_r()
 
433
lockf() [Added in POSIX.1-2008]
 
434
lseek()
 
435
lstat()
 
436
mkdir() [Added in POSIX.1-2008]
 
437
mkdirat() [Added in POSIX.1-2008]
 
438
mkdtemp() [Added in POSIX.1-2008]
 
439
mkfifo() [Added in POSIX.1-2008]
 
440
mkfifoat() [Added in POSIX.1-2008]
 
441
mknod() [Added in POSIX.1-2008]
 
442
mknodat() [Added in POSIX.1-2008]
 
443
mkstemp()
 
444
mktime()
 
445
nftw()
 
446
opendir()
 
447
openlog()
 
448
pathconf()
 
449
pclose()
 
450
perror()
 
451
popen()
 
452
posix_fadvise()
 
453
posix_fallocate()
 
454
posix_madvise()
 
455
posix_openpt()
 
456
posix_spawn()
 
457
posix_spawnp()
 
458
posix_trace_clear()
 
459
posix_trace_close()
 
460
posix_trace_create()
 
461
posix_trace_create_withlog()
 
462
posix_trace_eventtypelist_getnext_id()
 
463
posix_trace_eventtypelist_rewind()
 
464
posix_trace_flush()
 
465
posix_trace_get_attr()
 
466
posix_trace_get_filter()
 
467
posix_trace_get_status()
 
468
posix_trace_getnext_event()
 
469
posix_trace_open()
 
470
posix_trace_rewind()
 
471
posix_trace_set_filter()
 
472
posix_trace_shutdown()
 
473
posix_trace_timedgetnext_event()
 
474
posix_typed_mem_open()
 
475
printf()
 
476
psiginfo() [Added in POSIX.1-2008]
 
477
psignal() [Added in POSIX.1-2008]
 
478
pthread_rwlock_rdlock()
 
479
pthread_rwlock_timedrdlock()
 
480
pthread_rwlock_timedwrlock()
 
481
pthread_rwlock_wrlock()
 
482
putc()
 
483
putc_unlocked()
 
484
putchar()
 
485
putchar_unlocked()
 
486
puts()
 
487
pututxline()
 
488
putwc()
 
489
putwchar()
 
490
readdir()
 
491
readdir_r()
 
492
readlink() [Added in POSIX.1-2008]
 
493
readlinkat() [Added in POSIX.1-2008]
 
494
remove()
 
495
rename()
 
496
renameat() [Added in POSIX.1-2008]
 
497
rewind()
 
498
rewinddir()
 
499
scandir() [Added in POSIX.1-2008]
 
500
scanf()
 
501
seekdir()
 
502
semop()
 
503
setgrent()
 
504
sethostent()
 
505
setnetent()
 
506
setprotoent()
 
507
setpwent()
 
508
setservent()
 
509
setutxent()
 
510
sigpause() [Added in POSIX.1-2008]
 
511
stat()
 
512
strerror()
 
513
strerror_r()
 
514
strftime()
 
515
symlink()
 
516
symlinkat() [Added in POSIX.1-2008]
 
517
sync()
 
518
syslog()
 
519
tmpfile()
 
520
tmpnam()
 
521
ttyname()
 
522
ttyname_r()
 
523
tzset()
 
524
ungetc()
 
525
ungetwc()
 
526
unlink()
 
527
unlinkat() [Added in POSIX.1-2008]
 
528
utime() [Added in POSIX.1-2008]
 
529
utimensat() [Added in POSIX.1-2008]
 
530
utimes() [Added in POSIX.1-2008]
 
531
vdprintf() [Added in POSIX.1-2008]
 
532
vfprintf()
 
533
vfwprintf()
 
534
vprintf()
 
535
vwprintf()
 
536
wcsftime()
 
537
wordexp()
 
538
wprintf()
 
539
wscanf()
 
540
.fi
 
541
.in
 
542
 
 
543
An implementation may also mark other functions
 
544
not specified in the standard as cancellation points.
 
545
In particular, an implementation is likely to mark
 
546
any non-standard function that may block as a cancellation point.
 
547
(This includes most functions that can touch files.)
 
548
.\" So, scanning "cancellation point" comments in the glibc 2.8 header
 
549
.\" files, it looks as though at least the following non-standard
 
550
.\" functions are cancellation points:
 
551
.\" endnetgrent
 
552
.\" endspent
 
553
.\" epoll_pwait
 
554
.\" epoll_wait
 
555
.\" fcloseall
 
556
.\" fdopendir
 
557
.\" fflush_unlocked
 
558
.\" fgetc_unlocked
 
559
.\" fgetgrent
 
560
.\" fgetgrent_r
 
561
.\" fgetpwent
 
562
.\" fgetpwent_r
 
563
.\" fgets_unlocked
 
564
.\" fgetspent
 
565
.\" fgetspent_r
 
566
.\" fgetwc_unlocked
 
567
.\" fgetws_unlocked
 
568
.\" fputc_unlocked
 
569
.\" fputs_unlocked
 
570
.\" fputwc_unlocked
 
571
.\" fputws_unlocked
 
572
.\" fread_unlocked
 
573
.\" fwrite_unlocked
 
574
.\" gai_suspend
 
575
.\" getaddrinfo_a
 
576
.\" getdate_r
 
577
.\" getgrent_r
 
578
.\" getgrouplist
 
579
.\" gethostbyaddr_r
 
580
.\" gethostbyname2
 
581
.\" gethostbyname2_r
 
582
.\" gethostbyname_r
 
583
.\" gethostent_r
 
584
.\" getnetbyaddr_r
 
585
.\" getnetbyname_r
 
586
.\" getnetent_r
 
587
.\" getnetgrent
 
588
.\" getnetgrent_r
 
589
.\" getprotobyname_r
 
590
.\" getprotobynumber_r
 
591
.\" getprotoent_r
 
592
.\" getpw
 
593
.\" getpwent_r
 
594
.\" getservbyname_r
 
595
.\" getservbyport_r
 
596
.\" getservent_r
 
597
.\" getspent
 
598
.\" getspent_r
 
599
.\" getspnam
 
600
.\" getspnam_r
 
601
.\" getutmp
 
602
.\" getutmpx
 
603
.\" getw
 
604
.\" getwc_unlocked
 
605
.\" getwchar_unlocked
 
606
.\" initgroups
 
607
.\" innetgr
 
608
.\" mkostemp
 
609
.\" mkostemp64
 
610
.\" mkstemp64
 
611
.\" ppoll
 
612
.\" pthread_timedjoin_np
 
613
.\" putgrent
 
614
.\" putpwent
 
615
.\" putspent
 
616
.\" putw
 
617
.\" putwc_unlocked
 
618
.\" putwchar_unlocked
 
619
.\" rcmd
 
620
.\" rcmd_af
 
621
.\" rexec
 
622
.\" rexec_af
 
623
.\" rresvport
 
624
.\" rresvport_af
 
625
.\" ruserok
 
626
.\" ruserok_af
 
627
.\" setnetgrent
 
628
.\" setspent
 
629
.\" sgetspent
 
630
.\" sgetspent_r
 
631
.\" updwtmpx
 
632
.\" utmpxname
 
633
.\" vfscanf
 
634
.\" vfwscanf
 
635
.\" vscanf
 
636
.\" vsyslog
 
637
.\" vwscanf
236
638
.SS "Compiling on Linux"
237
639
On Linux, programs that use the Pthreads API should be compiled using
238
640
.IR "cc \-pthread" .
272
674
(Problems can result if this thread is inadvertently killed.)
273
675
.IP \- 3
274
676
Signals are used internally by the implementation.
275
 
On Linux 2.2 and later, the first three real-time signals are used.
 
677
On Linux 2.2 and later, the first three real-time signals are used
 
678
(see also
 
679
.BR signal (7)).
276
680
On older Linux kernels,
277
681
.B SIGUSR1
278
682
and
369
773
in the same thread group;
370
774
all members of a thread groups share the same PID.
371
775
NPTL does not employ a manager thread.
372
 
NPTL makes internal use of the first two real-time signals;
 
776
NPTL makes internal use of the first two real-time signals
 
777
(see also
 
778
.BR signal (7));
373
779
these signals cannot be used in applications.
374
780
 
375
781
NPTL still has at least one non-conformance with POSIX.1:
475
881
.BR gettid (2),
476
882
.BR proc (5),
477
883
.BR futex (7),
 
884
.BR signal (7),
478
885
.br
479
886
and various Pthreads manual pages, for example:
 
887
.BR pthread_attr_init (3),
480
888
.BR pthread_atfork (3),
 
889
.BR pthread_cancel (3),
481
890
.BR pthread_cleanup_push (3),
482
891
.BR pthread_cond_signal (3),
483
892
.BR pthread_cond_wait (3),
497
906
and
498
907
.BR pthread_testcancel (3)
499
908
.SH COLOPHON
500
 
This page is part of release 3.13 of the Linux
 
909
This page is part of release 3.14 of the Linux
501
910
.I man-pages
502
911
project.
503
912
A description of the project,