pthreads.7: Using thread IDs whose lifetime has expired gives undefined behavior

See https://bugzilla.kernel.org/show_bug.cgi?id=53061

Reported-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-05-05 21:11:59 +02:00
parent 0ad13546b4
commit ccbcc0aeed
1 changed files with 3 additions and 1 deletions

View File

@ -127,8 +127,10 @@ Thread IDs are guaranteed to be unique only within a process.
that ID by definition refers to a thread in that ID by definition refers to a thread in
the same process as the caller.) the same process as the caller.)
A thread ID may be reused after a terminated thread has been joined, The system may reuse a thread ID after a terminated thread has been joined,
or a detached thread has terminated. or a detached thread has terminated.
POSIX says: "If an application attempts to use a thread ID whose
lifetime has ended, the behavior is undefined."
.SS Thread-safe functions .SS Thread-safe functions
A thread-safe function is one that can be safely A thread-safe function is one that can be safely
(i.e., it will deliver the same results regardless of whether it is) (i.e., it will deliver the same results regardless of whether it is)