Thread ID vs. Pthread Handle (pthread_t)

In many threads implementations, the pthread_t abstract type is implemented as an integer (4 byte) thread ID. In the IBM® i implementation of Pthreads, the thread ID is a 64-bit integral value and the pthread_t is an abstraction (structure) that contains that value and others. This abstraction helps to allow the implementation to scale to thousands of threads in a process.

Do not allow your program to rely on the internal structure or size of the pthread_t in a non-portable fashion, such as comparisons of thread IDs. For portable comparison, use the pthread_equal() API. This documentation occasionally refers to the pthread_t as a Pthread handle to try to prevent the misconception that it represents a single integer value.

[ Back to top | Pthread APIs | APIs by category ]