
Howard Hinnant wrote:
Fwiw, this is the approach of N2184:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2184.html
The very biggest change between boost::thread and N2184 is the addition of cancellation. And, imho, this is a huge change.
There are several more minor changes:
* The N2184::thread is non-copyable like boost::thread, but movable (taking advantage of new C++ language and std::lib features). Movable N2184::thread maintains the one-to-one mapping between the std::thread and the OS thread which boost has (sole ownership semantics). It just adds the ability to move the thread between scopes (such as return from factory functions). I recently drew the analogy this way:
boost::thread is like a scoped_ptr to the OS thread. N2184::thread is like an auto_ptr to the OS thread (the proposed unique_ptr would be a more accurate analogy).
Makes a lot of sense. Makes me wonder why the mutexes in N2094 are not movable also.
* N2184::thread separates out the concept of thread identity and thread handle. In boost these are both just boost::thread. The thread::id is copyable. The only thing you can do with it is equality compare it.
I think we might want it to be OutStreamable also. Mainly for debugging and logging purposes.