thread_self Subroutine
Purpose
Returns the caller's kernel thread ID.
Library
Standard C library (libc.a)
Syntax
#include <sys/thread.h>
tid_t thread_self ()
Description
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.
Return Values
The thread_self subroutine returns the caller's kernel thread ID.