|
Boost : |
From: Moore, Dave (dmoore_at_[hidden])
Date: 2002-04-04 14:27:45
> >William, I have a question regarding your statement about the
> >representation
> >of pthread_t.
> >
> >On which platform isn't this printable?
>
> I'm not a POSIX expert, but none of the books or
> documentation I've found
> describe any methods that allow you to print a pthread_t. A
> quick web
> search shows only cases where someone passes an "id" into the
> thread for
> this purpose. So, AFAIK, this isn't possible on *any*
> platform. If I'm
> wrong about this, I'd like to know it.
Bill, on pthreads-win32, it's a pointer to a struct pthread_t_. Without
checking the Open Group specs, my suspicion is that you are technically
correct that it's an opaque type, but that on most implementations people
are used to getting away with using:
pthread_t pt;
printf("%d",pt);
// or
printf("%p",pt);
I strongly agree with your proposed approach of using a TLS slot for a
cross-platform integer thread id (or even a string or something for
debugging - symbolic thread names, etc.)
Regards,
Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk