Rewrote DESCRIPTION; noted that thread ID is not the same

thing as a POSIX thread ID.
This commit is contained in:
Michael Kerrisk 2008-01-12 12:43:44 +00:00
parent 616e34302b
commit fd48405669
1 changed files with 16 additions and 12 deletions

View File

@ -1,6 +1,8 @@
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright 2003 Abhijit Menon-Sen <ams@wiw.org>
.\" and Copyright (C) 2008 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" 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),