From 84ee6c22e3163dd5c25fd15e59b55d1e509e01ee Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 6 Nov 2008 09:37:23 -0500 Subject: [PATCH] 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 --- man7/pthreads.7 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/man7/pthreads.7 b/man7/pthreads.7 index 9c7644d4c..1b4a3bb6c 100644 --- a/man7/pthreads.7 +++ b/man7/pthreads.7 @@ -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)