From: William Kempf (williamkempf_at_[hidden])
Date: 2002-04-04 10:07:12
>From: "Hoeffner, Detlef" <Detlef.Hoeffner_at_[hidden]>
>To: "'boost_at_[hidden]'" <boost_at_[hidden]>
>Subject: RE: [boost] Thread locals
>Date: Wed, 3 Apr 2002 18:53:55 +0200
> > However, I understand the convenience of this and so
> > I'll add something soon. Thanks for the suggestion.
> > The only thing missing in boost::thread from your list is
> > operator<<(ostream&, ).
>I still do not see how I would identify the current instance of thread.
>Am I missing something?
The default constructor creates a boost::thread for the current thread, and
boost::thread has == and != operators that can then be used for the
comparison. Again, the only thing missing from your list was a way to
output and identifying textual representation. Though to really be useful
we also need a copyable form of ID.
> > I'm going to work around this by using a TSS pointer value,
> > which seems to be the best solution, though it's not a perfect solution.
>I guess for performance issues it would be preferable to use functions the
>operating system or the thread library provides, e.g.
> static thread_id getCurrentThreadId()
> return pthread_self();
> return GetCurrentThreadId();
The reasons to not do this:
1. It doesn't provide a means for outputting a textual representation.
2. It doesn't provide LessThanComparable semantics, so it can't be used as a
key in a set/map, which isn't in your list of needs but is still something I
think we need.
MSN Photos is the easiest way to share and print your photos:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk