Boost logo

Boost Users :

From: olivier_debels olivier_debels_at_[hidden])
Date: 2002-12-18 04:34:36


--- In Boost-Users_at_[hidden], "William E. Kempf"
<wekempf_at_c...> wrote:
> > <alternative exemplar>
> > When I implemented the Leader-Follower thread pattern described
by
> > Schmidt, et al in Pattern-Oriented Software Architecture, I
couldn't
> > figure out a way around comparing the thread id to the current
leader in
> > the
> > promote_new_leader function. Probably lack of imagination and/or
> > experience on my part, but having the thread id sure made it
easier.
> > </alternative exemplar>
>
> If all you need is comparisons, the boost::thread class provides
this
> today. That's why I wanted specific requirements for a thread id.
> Currently the things a thread id can provide that thread does not,
AFAIK,
> are the following:
>
> * Can be copied.
> * Can be turned into a unique string for printing/etc.
>
> These features will be accounted for, I just need to be sure these
are the
> only features missing.
>
> William E. Kempf

Ok,

So instead of comparing id's we compare threads. Fine. This means
I need a map of thread references instead of ids.

If I have a thread reference and I want to check if it is the
current active thread I can do the following?

           thread_ref == Thread();

As far as I understood calling the constructor without arguments
returns the current thread. So I can compare that one with my
thread references. That would be great! (I guess it is great)

thx,

Olivier.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net