|
Hi Craig,
This code should use a conditional for each platform: pthread_t is an opaque type, and any "automatic" convertion to an integer is somewhat dangerous, as it could yield the same id for different threads on some platform.
On FreeBSD since pthread_t is a pointer to a per-thread structure, you can safely use reinterpret_cast<unsigned long>(pthread_self()).
On Tru64, for example, the correct code would be pthread_getsequence_np(pthread_self()).
Cheers,
Bernard
|