Posts here on SO suggest that pthread_t
is an opaque type, not a number, certainly not a thread index, that you shouldn\'t directly compare pthread_t
The POSIX standard allows pthread_t
to be something more complex (such as a structure). See this previous question, especially the answer by @james-mcnellis. Money quote:
IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/26 is applied, adding pthread_t to the list of types that are not required to be arithmetic types, thus allowing pthread_t to be defined as a structure.
UPDATE: Here are a few examples of more complex pthread_t
definitions:
And here is an ancient (2007) justification of the pthread_t
structure used in the pthreads library for Win32: https://sourceware.org/ml/pthreads-win32/2007/msg00056.html