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
's, etc. etc.
Questions:
Why? Is there really the intent to support systems with no numeric IDs for threads? When the
pthread_t
implementation is simplytypedef unsigned long int pthread_t;
?
How? There's a comment before the above line, so it's actually
/* Thread identifiers. The structure of the attribute type is not exposed on purpose. */ typedef unsigned long int pthread_t;
in
pthreadtypes.h
what does that mean? What attribute type? Isn't this an index into some global table of threads?
unsigned long
(this assumes ILP32 or LP64 model) for legacy compatibility reasons but the content is actually an address. – Weiner