olivier_debels said:
<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.
If all you need is comparisons, the boost::thread class provides
--- In Boost-Users@yahoogroups.com, "William E. Kempf"
wrote: 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)
Accept there is no thread_ref in Boost.Threads. The current version of Boost.Threads *IS* going to stand in your way here, and I aknowledge that. I'm addressing the issues for the next version, but that's why I needed to know specifically what you need a thread id for. Is it only for comparisons and display? William E. Kempf