pthreads.7: Add a section describing thread IDs

In particular, note that in each pthreads function that takes
a thread ID argument, that ID by definition refers to a thread
in the same process as the caller.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2008-11-06 09:37:23 -05:00
parent 3ba07ec788
commit 84ee6c22e3
1 changed files with 15 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-10-16 "Linux" "Linux Programmer's Manual"
.TH PTHREADS 7 2008-11-07 "Linux" "Linux Programmer's Manual"
.SH NAME
pthreads \- POSIX threads
.SH DESCRIPTION
@ -113,6 +113,20 @@ Note that the pthreads functions do not set
For each of the pthreads functions that can return an error,
POSIX.1-2001 specifies that the function can never fail with the error
.BR EINTR .
.SS Thread IDs
Each of the threads in a process has a unique thread identifier
(stored in the type
.IR pthread_t ).
This identifier is returned to the caller of
.BR pthread_create (3),
and a thread can obtain its own thread identifier using
.BR pthread_self (3).
Thread IDs are only guaranteed to be unique within a process.
A thread ID may be reused after a terminated thread has been joined,
or a detached thread has terminated.
In all pthreads functions that accept a thread ID as an argument,
that ID by definition refers to a thread in
the same process as the caller.
.SS "Thread-safe functions"
A thread-safe function is one that can be safely
(i.e., it will deliver the same results regardless of whether it is)