From: Hoeffner, Detlef (Detlef.Hoeffner_at_[hidden])
Date: 2002-04-04 01:31:03
> 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?
> 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()
From: William Kempf [mailto:williamkempf_at_[hidden]]
Sent: Mittwoch, 3. April 2002 17:05
Subject: RE: [boost] Thread locals
>From: "Hoeffner, Detlef" <Detlef.Hoeffner_at_[hidden]>
>To: "'boost_at_[hidden]'" <boost_at_[hidden]>
>Subject: RE: [boost] Thread locals
>Date: Wed, 3 Apr 2002 16:37:41 +0200
> > As a substitute, try using the comparison operator for the boost::thread
> > class. This can fill the gap in many (but not all) cases where you are
> > managing the set of threads yourself.
>I need this mainly for tracing purposes in spots where I have no knowledge
>of the current instance of thread. This does not seem to help me in that
> > On some platforms (i.e. pthreads), the "thread_id" is actually an opaque
> > type (pthread_t) rather than a numeric value, and I think that is why no
> > such operation is exposed in the current version of the library.
>It is however possible to provide a class threadid, that has dependent on
>platform different members but provides operations as ==, !=,
>operator<<(ostream&, ), ... That would be fine to solve the problem.
The only thing missing in boost::thread from your list is
operator<<(ostream&, ). That's actually the tricky one to do portably. The
pthread_t opaque type provides no way to output a unique textual
representation. 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.
BTW, there's another operation needed for thread_id that you didn't
mention... it needs to be copy constructable.
Chat with friends online, try MSN Messenger: http://messenger.msn.com
Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk