[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 2

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.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

Related Information

The bindprocessor subroutine, pthread_self subroutine, ptrace subroutine.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]