1GETTID(2) Linux Programmer's Manual GETTID(2)
2
3
4
6 gettid - get thread identification
7
9 #include <sys/types.h>
10
11 pid_t gettid(void);
12
14 gettid() returns the caller's thread ID (TID). In a single-threaded
15 process, the thread ID is equal to the process ID (PID, as returned by
16 getpid(2)). In a multithreaded process, all threads have the same PID,
17 but each one has a unique TID. For further details, see the discussion
18 of CLONE_THREAD in clone(2).
19
21 On success, returns the thread ID of the calling process.
22
24 This call is always successful.
25
27 The gettid() system call first appeared on Linux in kernel 2.4.11.
28
30 gettid() is Linux-specific and should not be used in programs that are
31 intended to be portable.
32
34 Glibc does not provide a wrapper for this system call; call it using
35 syscall(2).
36
37 The thread ID returned by this call is not the same thing as a POSIX
38 thread ID (i.e., the opaque value returned by pthread_self(3)).
39
41 clone(2), fork(2), getpid(2)
42
44 This page is part of release 3.22 of the Linux man-pages project. A
45 description of the project, and information about reporting bugs, can
46 be found at http://www.kernel.org/doc/man-pages/.
47
48
49
50Linux 2008-04-14 GETTID(2)