pthreads.7: Add section on cancellation points

This section includes a list of the functions that must and
may be cancellation points.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2008-11-10 12:00:51 -05:00
parent da8dbaa525
commit ffe8c4ae77
1 changed files with 403 additions and 1 deletions

View File

@ -21,7 +21,7 @@
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.TH PTHREADS 7 2008-11-07 "Linux" "Linux Programmer's Manual"
.TH PTHREADS 7 2008-11-10 "Linux" "Linux Programmer's Manual"
.SH NAME
pthreads \- POSIX threads
.SH DESCRIPTION
@ -233,6 +233,408 @@ POSIX.1-2008 removes ecvt(), fcvt(), gcvt(), gethostbyname(),
and gethostbyaddr() from the above list
(because those functions are removed from the standard), and adds
strerror() and system().
.SS Cancellation Points
POSIX.1 specifies that certain functions must,
and certain other functions may, be cancellation points.
If a thread is cancelable, its cancelability type is deferred,
and a cancellation request is pending for the thread,
then the thread is canceled when it calls a function
that is a cancellation point.
The following functions are required to be cancellation points by
POSIX.1-2001 and/or POSIX.1-2008:
.in +4n
.nf
accept()
aio_suspend()
clock_nanosleep()
close()
connect()
creat()
fcntl() F_SETLKW
fdatasync()
fsync()
getmsg()
getpmsg()
lockf() F_LOCK
mq_receive()
mq_send()
mq_timedreceive()
mq_timedsend()
msgrcv()
msgsnd()
msync()
nanosleep()
open()
openat() [Added in POSIX.1-2008]
pause()
poll()
pread()
pselect()
pthread_cond_timedwait()
pthread_cond_wait()
pthread_join()
pthread_testcancel()
putmsg()
putpmsg()
pwrite()
read()
readv()
recv()
recvfrom()
recvmsg()
select()
sem_timedwait()
sem_wait()
send()
sendmsg()
sendto()
sigpause() [POSIX.1-2001 only (function removed in POSIX.1-2008)]
sigsuspend()
sigtimedwait()
sigwait()
sigwaitinfo()
sleep()
system()
tcdrain()
usleep() [POSIX.1-2001 only (function removed in POSIX.1-2008)]
wait()
waitid()
waitpid()
write()
writev()
.fi
.in
The following functions may be cancellation points according to
POSIX.1-2001 and/or POSIX.1-2008:
.in +4n
.nf
access()
asctime()
asctime_r()
catclose()
catgets()
catopen()
chmod() [Added in POSIX.1-2008]
chown() [Added in POSIX.1-2008]
closedir()
closelog()
ctermid()
ctime()
ctime_r()
dbm_close()
dbm_delete()
dbm_fetch()
dbm_nextkey()
dbm_open()
dbm_store()
dlclose()
dlopen()
dprintf() [Added in POSIX.1-2008]
endgrent()
endhostent()
endnetent()
endprotoent()
endpwent()
endservent()
endutxent()
faccessat() [Added in POSIX.1-2008]
fchmod() [Added in POSIX.1-2008]
fchmodat() [Added in POSIX.1-2008]
fchown() [Added in POSIX.1-2008]
fchownat() [Added in POSIX.1-2008]
fclose()
fcntl() (for any value of cmd argument)
fflush()
fgetc()
fgetpos()
fgets()
fgetwc()
fgetws()
fmtmsg()
fopen()
fpathconf()
fprintf()
fputc()
fputs()
fputwc()
fputws()
fread()
freopen()
fscanf()
fseek()
fseeko()
fsetpos()
fstat()
fstatat() [Added in POSIX.1-2008]
ftell()
ftello()
ftw()
futimens() [Added in POSIX.1-2008]
fwprintf()
fwrite()
fwscanf()
getaddrinfo()
getc()
getc_unlocked()
getchar()
getchar_unlocked()
getcwd()
getdate()
getdelim() [Added in POSIX.1-2008]
getgrent()
getgrgid()
getgrgid_r()
getgrnam()
getgrnam_r()
gethostbyaddr() [SUSv3 only (function removed in POSIX.1-2008)]
gethostbyname() [SUSv3 only (function removed in POSIX.1-2008)]
gethostent()
gethostid()
gethostname()
getline() [Added in POSIX.1-2008]
getlogin()
getlogin_r()
getnameinfo()
getnetbyaddr()
getnetbyname()
getnetent()
getopt() (if opterr is non-zero)
getprotobyname()
getprotobynumber()
getprotoent()
getpwent()
getpwnam()
getpwnam_r()
getpwuid()
getpwuid_r()
gets()
getservbyname()
getservbyport()
getservent()
getutxent()
getutxid()
getutxline()
getwc()
getwchar()
getwd() [SUSv3 only (function removed in POSIX.1-2008)]
glob()
iconv_close()
iconv_open()
ioctl()
link()
linkat() [Added in POSIX.1-2008]
lio_listio() [Added in POSIX.1-2008]
localtime()
localtime_r()
lockf() [Added in POSIX.1-2008]
lseek()
lstat()
mkdir() [Added in POSIX.1-2008]
mkdirat() [Added in POSIX.1-2008]
mkdtemp() [Added in POSIX.1-2008]
mkfifo() [Added in POSIX.1-2008]
mkfifoat() [Added in POSIX.1-2008]
mknod() [Added in POSIX.1-2008]
mknodat() [Added in POSIX.1-2008]
mkstemp()
mktime()
nftw()
opendir()
openlog()
pathconf()
pclose()
perror()
popen()
posix_fadvise()
posix_fallocate()
posix_madvise()
posix_openpt()
posix_spawn()
posix_spawnp()
posix_trace_clear()
posix_trace_close()
posix_trace_create()
posix_trace_create_withlog()
posix_trace_eventtypelist_getnext_id()
posix_trace_eventtypelist_rewind()
posix_trace_flush()
posix_trace_get_attr()
posix_trace_get_filter()
posix_trace_get_status()
posix_trace_getnext_event()
posix_trace_open()
posix_trace_rewind()
posix_trace_set_filter()
posix_trace_shutdown()
posix_trace_timedgetnext_event()
posix_typed_mem_open()
printf()
psiginfo() [Added in POSIX.1-2008]
psignal() [Added in POSIX.1-2008]
pthread_rwlock_rdlock()
pthread_rwlock_timedrdlock()
pthread_rwlock_timedwrlock()
pthread_rwlock_wrlock()
putc()
putc_unlocked()
putchar()
putchar_unlocked()
puts()
pututxline()
putwc()
putwchar()
readdir()
readdir_r()
readlink() [Added in POSIX.1-2008]
readlinkat() [Added in POSIX.1-2008]
remove()
rename()
renameat() [Added in POSIX.1-2008]
rewind()
rewinddir()
scandir() [Added in POSIX.1-2008]
scanf()
seekdir()
semop()
setgrent()
sethostent()
setnetent()
setprotoent()
setpwent()
setservent()
setutxent()
sigpause() [Added in POSIX.1-2008]
stat()
strerror()
strerror_r()
strftime()
symlink()
symlinkat() [Added in POSIX.1-2008]
sync()
syslog()
tmpfile()
tmpnam()
ttyname()
ttyname_r()
tzset()
ungetc()
ungetwc()
unlink()
unlinkat() [Added in POSIX.1-2008]
utime() [Added in POSIX.1-2008]
utimensat() [Added in POSIX.1-2008]
utimes() [Added in POSIX.1-2008]
vdprintf() [Added in POSIX.1-2008]
vfprintf()
vfwprintf()
vprintf()
vwprintf()
wcsftime()
wordexp()
wprintf()
wscanf()
.fi
.in
An implementation may also mark other functions
not specified in the standard as cancellation points.
In particular, an implementation is likely to mark
any non-standard function that may block as a cancellation point.
(This includes most functions that can touch files.)
.\" So, scanning "cancellation point" comments in the glibc 2.8 header
.\" files, it looks as though at least the following non-standard
.\" functions are cancellation points:
.\" endnetgrent
.\" endspent
.\" epoll_pwait
.\" epoll_wait
.\" fcloseall
.\" fdopendir
.\" fflush_unlocked
.\" fgetc_unlocked
.\" fgetgrent
.\" fgetgrent_r
.\" fgetpwent
.\" fgetpwent_r
.\" fgets_unlocked
.\" fgetspent
.\" fgetspent_r
.\" fgetwc_unlocked
.\" fgetws_unlocked
.\" fputc_unlocked
.\" fputs_unlocked
.\" fputwc_unlocked
.\" fputws_unlocked
.\" fread_unlocked
.\" fwrite_unlocked
.\" gai_suspend
.\" getaddrinfo_a
.\" getdate_r
.\" getgrent_r
.\" getgrouplist
.\" gethostbyaddr_r
.\" gethostbyname2
.\" gethostbyname2_r
.\" gethostbyname_r
.\" gethostent_r
.\" getnetbyaddr_r
.\" getnetbyname_r
.\" getnetent_r
.\" getnetgrent
.\" getnetgrent_r
.\" getprotobyname_r
.\" getprotobynumber_r
.\" getprotoent_r
.\" getpw
.\" getpwent_r
.\" getservbyname_r
.\" getservbyport_r
.\" getservent_r
.\" getspent
.\" getspent_r
.\" getspnam
.\" getspnam_r
.\" getutmp
.\" getutmpx
.\" getw
.\" getwc_unlocked
.\" getwchar_unlocked
.\" initgroups
.\" innetgr
.\" mkostemp
.\" mkostemp64
.\" mkstemp64
.\" ppoll
.\" pthread_timedjoin_np
.\" putgrent
.\" putpwent
.\" putspent
.\" putw
.\" putwc_unlocked
.\" putwchar_unlocked
.\" rcmd
.\" rcmd_af
.\" rexec
.\" rexec_af
.\" rresvport
.\" rresvport_af
.\" ruserok
.\" ruserok_af
.\" setnetgrent
.\" setspent
.\" sgetspent
.\" sgetspent_r
.\" updwtmpx
.\" utmpxname
.\" vfscanf
.\" vfwscanf
.\" vscanf
.\" vsyslog
.\" vwscanf
.SS "Compiling on Linux"
On Linux, programs that use the Pthreads API should be compiled using
.IR "cc \-pthread" .