1GETTID(2) Linux Programmer's Manual GETTID(2)
2
3
4
6 gettid - get thread identification
7
9 #include <sys/types.h>
10 #include <linux/unistd.h>
11 #include <errno.h>
12
13 _syscall0(pid_t, gettid)
14 /* Using syscall(2) may be preferable; see intro(2) */
15
16 pid_t gettid(void);
17
19 gettid() returns the thread ID of the current process. This is equal to
20 the process ID (as returned by getpid(2)), unless the process is part
21 of a thread group (created by specifying the CLONE_THREAD flag to the
22 clone(2) system call). All processes in the same thread group have the
23 same PID, but each one has a unique TID.
24
26 On success, returns the thread ID of the current process.
27
29 This call is always successful.
30
32 gettid() is Linux specific and should not be used in programs that are
33 intended to be portable.
34
36 clone(2), fork(2), getpid(2)
37
38
39
40Linux 2.4.20 2003-02-01 GETTID(2)