Boost logo

Boost :

From: William Kempf (williamkempf_at_[hidden])
Date: 2002-04-04 14:41:27


>From: "Moore, Dave" <dmoore_at_[hidden]>
>Reply-To: boost_at_[hidden]
>To: "'boost_at_[hidden]'" <boost_at_[hidden]>
>Subject: RE: [boost] Thread locals
>Date: Thu, 4 Apr 2002 14:27:45 -0500
>
> > >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);

Oh, I'm quite certain that most platforms define pthread_t as a pointer to
some struct type. But I'm also certain that the type is specified in the
standard as opaque, and thus the example usage you just gave results in
undefined behavior and is non-conforming code.

Bill Kempf
williamkempf_at_[hidden]

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk