VMS Help  —  POSIX Threads, PTHREAD routines, pthread_self
    Obtains the identifier of the calling thread.

1  –  C Binding

    #include <pthread.h>

    pthread_t
    pthread_self (void);

2  –  Arguments

    None

3  –  Description

    This routine returns the address of the calling thread's own
    thread identifier. For example, you can use this thread object
    to obtain the calling thread's own sequence number. To do so,
    pass the return value from this routine in a call to the pthread_
    getsequence_np() routine, as follows:

       .
       .
       .
       unsigned long     this_thread_nbr;
       .
       .
       .
       this_thread_nbr = pthread_getsequence_np( pthread_self( ) );
       .
       .
       .

    The return value from the pthread_self() routine becomes
    meaningless after the calling thread is destroyed.

4  –  Return Values

    Returns the address of the calling thread's own thread object.

5  –  Associated Routines

       pthread_cancel()
       pthread_create()
       pthread_detach()
       pthread_exit()
       pthread_getsequence_np()
       pthread_join()
       pthread_kill()
       pthread_sigmask()
Close Help