Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-09-24 14:18:25


--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> class thread
> {
> unsigned long id() const; // uniquely identifies the thread
> };
>
> What do you think?

I think it's a pain in the @$$ to implement on POSIX ;).

Seriously, though, I did consider this and rejected it, at least for
the short term, because it is difficult to define for POSIX
implementations. The "ID" on POSIX systems is an opaque type, and is
likely a pointer and not an integral value. For most purposes you
don't really need this method any way, since we support operators ==
and != (I realize this isn't enough for collation, but since
boost::thread isn't copyable there's not a lot of need for full
collation). The only thing I can think of that's not available
directly is a way to print out an identification string for
diagnostic purposes. In that case we may be better benefitted by
supplying a stream output operator, which would likely be easier to
implement in a platform independant manner.

Bill Kempf


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