
On Mar 19, 2007, at 5:29 PM, Sohail Somani wrote:
I was pretty much hoping for boost threads + cancellation.
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). * 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. * N2184::thread moves some of the static boost thread members (yield, sleep) to a namespace called this_thread. So the syntax for calling them is std::this_thread::yield() as opposed to boost::thread::yield(). * N2184::threads adds a "back door escape hatch" to the OS thread called native_handle(). You can get that from the std::thread and do non-portable things with it at the OS level (setting thread priority is the poster child). N2184 does not mention the rest of boost::threads (mutex, locks, condition, thread_once, TLS, etc.). All of that stuff is pretty much assumed modulo details - TLS will be in the language, not the lib. N2184 just concentrates on the thread class (which has been much more controversial). -Howard