gettid(2)


NAME

   gettid - get thread identification

SYNOPSIS

   #include <sys/types.h>

   pid_t gettid(void);

   Note: There is no glibc wrapper for this system call; see NOTES.

DESCRIPTION

   gettid()  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
   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 CLONE_THREAD in clone(2).

RETURN VALUE

   On success, returns the thread ID of the calling process.

ERRORS

   This call is always successful.

VERSIONS

   The gettid() system call first appeared on Linux in kernel 2.4.11.

CONFORMING TO

   gettid()  is Linux-specific and should not be used in programs that are
   intended to be portable.

NOTES

   Glibc does not provide a wrapper for this system call;  call  it  using
   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 pthread_self(3)).

   In a new thread group created by a clone(2) call that does not  specify
   the  CLONE_THREAD  flag  (or,  equivalently,  a  new process created by
   fork(2)), the new process is a thread  group  leader,  and  its  thread
   group ID (the value returned by getpid(2)) is the same as its thread ID
   (the value returned by gettid()).

SEE ALSO

   capget(2),    clone(2),    fcntl(2),    fork(2),    get_robust_list(2),
   ioprio_set(2),         perf_event_open(2),        sched_setaffinity(2),
   sched_setparam(2), sched_setscheduler(2), tgkill(2), timer_create(2)

COLOPHON

   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at
   https://www.kernel.org/doc/man-pages/.


More Linux Commands

manpages/kbruch.1.html
kbruch(1) Learn calculating with fractions - Linux man page
KBruch is a small program to practice calculating with fractions. Different exercises are provided for this purpose. The program checks users input and gives fe

manpages/Term::Complete.3pm.html
Term::Complete(3pm) - Perl word completion module (ManPage)
This routine provides word completion on the list of words in the array (or array ref). The tty driver is put into raw mode and restored using an operating syst

manpages/thin_rmap.8.html
thin_rmap(8) output reverse map of a thin provisioned region
thin_rmap outputs the reverse mapping stored in the metadata on a device or file between a region of thin provisioned pool blocks and the associated thin provis

manpages/curl_easy_setopt.3.html
curl_easy_setopt(3) - set options for a curl easy handle....
curl_easy_setopt() is used to tell libcurl how to behave. By using the appropriate options to curl_easy_setopt, you can change libcurls behavior. All options ar

manpages/fgetc.3.html
fgetc(3) - input of characters and strings - Linux man page
fgetc() reads the next character from stream and returns it as an unsigned char cast to an int, or EOF on end of file or error. getc() is equivalent to fgetc()

manpages/panel_above.3curses.html
panel_above(3curses) - panel stack extension for curses.....
Panels are ncurses(3NCURSES) windows with the added feature of depth. Panel functions allow the use of stacked windows and ensure the proper portions of each wi

manpages/pcre32_copy_named_substring.3.html
pcre32_copy_named_substring(3) Perl-compatible regular expre
This is a convenience function for extracting a captured substring, identified by name, into a given buffer. The arguments are: code Pattern that was successful

manpages/IO::Stringy.3pm.html
IO::Stringy(3pm) - I/O on in-core objects like strings and a
This toolkit primarily provides modules for performing both traditional and object-oriented i/o) on things other than normal filehandles; in particular, IO::Sca

manpages/malloc_get_state.3.html
malloc_get_state(3) record and restore state of malloc imple
The malloc_get_state() function records the current state of all malloc(3) internal bookkeeping variables (but not the actual contents of the heap or the state

manpages/verr.3.html
verr(3) - formatted error messages - Linux manual page......
The err() and warn() family of functions display a formatted error message on the standard error output. In all cases, the last component of the program name, a

manpages/send.2.html
send(2) - send a message on a socket - Linux manual page....
The system calls send(), sendto(), and sendmsg() are used to transmit a message to another socket. The send() call may be used only when the socket is in a conn

manpages/gnutls_hash_init.3.html
gnutls_hash_init(3) - API function - Linux manual page......
This function will initialize an context that can be used to produce a Message Digest of data. This will effectively use the current crypto backend in use by gn





We can't live, work or learn in freedom unless the software we use is free.