[Prev] [Contents] [Next]

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 AS/400 implementation of Pthreads, the thread id is a 64 bit integral value and the pthread_t is an abstraction (structure) which 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 rely on the internal structure or size of the pthread_t in a non-portable fashion. This includes comparison of the thread id. For portable comparison, use the pthread_equal() API. We'll refer to the pthread_t as a Pthread handle in order to try to prevent the concept that it represents a single integer value.



[Prev] [Contents] [Next]
Copyright © 1998, IBM Corporation. All rights reserved.
Comments? Contact
rchthrds@us.ibm.com