From fd48405669381c5109bfce20fbf6abed2e370aec Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sat, 12 Jan 2008 12:43:44 +0000 Subject: [PATCH] Rewrote DESCRIPTION; noted that thread ID is not the same thing as a POSIX thread ID. --- man2/gettid.2 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/man2/gettid.2 b/man2/gettid.2 index 3c90a4090..4d1c9e21f 100644 --- a/man2/gettid.2 +++ b/man2/gettid.2 @@ -1,6 +1,8 @@ .\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright 2003 Abhijit Menon-Sen +.\" and Copyright (C) 2008 Michael Kerrisk +.\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. @@ -21,7 +23,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH GETTID 2 2007-06-01 "Linux" "Linux Programmer's Manual" +.TH GETTID 2 2008-01-12 "Linux" "Linux Programmer's Manual" .SH NAME gettid \- get thread identification .SH SYNOPSIS @@ -32,18 +34,16 @@ gettid \- get thread identification .fi .SH DESCRIPTION .BR gettid () -returns the thread ID of the calling process. -This is equal -to the process ID (as returned by -.BR getpid (2)), -unless the process is part of a thread group (created by specifying -the -.B CLONE_THREAD -flag to the -.BR clone (2) -system call). -All processes in the same thread group +returns the caller's thread ID (TID). +In a single-threaded process, the thread ID +is equal to the process ID (PID, as returned by +.BR getpid (2)). +In a multithreaded process, all threads have the same PID, but each one has a unique TID. +For further details, see the discussion of +.BR CLONE_THREAD +in +.BR clone (2). .SH "RETURN VALUE" On success, returns the thread ID of the calling process. .SH ERRORS @@ -55,6 +55,10 @@ are intended to be portable. .SH NOTES Glibc does not provide a wrapper for this system call; call it using .BR syscall (2). + +The thread ID returned by this call is not the same thing as a +POSIX thread ID (i.e., the opaque value returned by +.BR pthread_self (3)). .SH "SEE ALSO" .BR clone (2), .BR fork (2),