Returns the caller's kernel thread ID.
Standard C library (libc.a)
#include <sys/thread.h>
tid_t thread_self ()
The thread_self subroutine returns the caller's kernel thread ID. The kernel thread ID may be useful for the bindprocessor and ptrace subroutines. The ps, trace, and vmstat commands also report kernel thread IDs, thus this subroutine can be useful for debugging multi-threaded programs.
The kernel thread ID is unrelated with the thread ID used in the threads library (libpthreads.a) and returned by the pthread_self subroutine.
The thread_self subroutine returns the caller's kernel thread ID.