PTHREAD_SELF(3) manual page

#### POSIX Threads for Windows – REFERENCE - Pthreads4W

Reference Index

Table of Contents

## Name

pthread_self - return identifier of current thread

## Synopsis

#include <pthread.h>

pthread_t pthread_self(void);

## Description

pthread_self return the thread identifier for the calling thread.

PThreads4W also provides support for Win32 native threads to interact with POSIX threads through the pthreads API. Whereas all threads created via a call to pthread_create have a POSIX thread ID and thread state, the library ensures that any Win32 native threads that interact through the Pthreads API also generate a POSIX thread ID and thread state when and if necessary. This provides full reciprocity between Win32 and POSIX threads. Win32 native threads that generate a POSIX thread ID and state are treated by the library as having been created with the PTHREAD_CREATE_DETACHED attribute.

Any Win32 native thread may call pthread_self directly to return it's POSIX thread identifier. The ID and state will be generated if it does not already exist. Win32 native threads do not need to call pthread_self before calling PThreads4W routines unless that routine requires a pthread_t parameter.

## Author

Xavier Leroy <Xavier.Leroy@inria.fr>

Modified by Ross Johnson for use with Pthreads4W.

## See Also

pthread_equal(3) , pthread_join(3) , pthread_detach(3) , pthread_setschedparam(3) , pthread_getschedparam(3) .

Table of Contents

- Name

- Synopsis

- Description

- Author

- See Also