[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: Thread ID



you can get the handle / id of a thread from within itself using the
pthread_self() call. 
the following is slightly AIX biased doc but will work with all pthread
implementations all the same.
For a tuorial on pthreads, go to the lawrence livermore national lab site..
http://www.llnl.gov/computing/tutorials/workshops/workshop/pthreads/MAIN.htm
l

HTH
Shourya
_______________________________________________
Shourya Sarcar || Global Software Platforms
gemedicalsystems.com || ge.com || elfun.org
5263121 xt 362 || shourya@xxxxxxxxxxx


<snip>
           
----------------------------------------------------------------------------
----
AIX Version 4.3 Base Operating System and Extensions Technical Reference,
Volume
                                       1
----------------------------------------------------------------------------
----

pthread_self Subroutine

Purpose

Returns the calling thread's ID.

Library

Threads Library (libpthreads.a)

Syntax

#include 

pthread_t pthread_self (void);

Description

The pthread_self subroutine returns the calling thread's ID.

    Note: The pthread.h header file must be the first included file of each
    source file using the threads library. Otherwise, the -D_THREAD_SAFE
    compilation flag should be used, or the cc_r compiler used. In this
case, the
    flag is automatically set.

Return Values

The calling thread's ID is returned.

Errors

No errors are defined.

The pthread_self function will not return an error code of EINTR.

Implementation Specifics

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

Related Information

The pthread_create subroutine, pthread_equal subroutine, pthread.h file.

Creating Threads in AIX Version 4.3 General Programming Concepts: Writing
and
Debugging Programs.

Threads Library Quick Reference in AIX Version 4.3 General Programming
Concepts:
Writing and Debugging Programs.
----------------------------------------------------------------------------
----
           
</snip>

-----Original Message-----
From: vnair@xxxxxxxxxxx [mailto:vnair@xxxxxxxxxxx]
Sent: Tuesday, December 05, 2000 9:57 PM
To: linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx
Subject: [LIP] Thread ID




Hello list,

I couldn't find a sys call to find the thread id of the thread from itself
...
something like..

TIA





---------------------------------------------
An alpha version of a web based tool to manage
your subscription with this mailing list is at
http://lists.linux-india.org/cgi-bin/mj_wwwusr