|
Boost : |
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2007-03-21 18:01:27
> * 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).
This assumes that it is not desirable for the same N2184::thread object to
be shared between multiple owners. The rationale given for the non-copyable
semantics of boost::thread states that the only time you need copyable
handle is in what they call "Use case 6: Creation of a thread whose
ownership is shared between multiple objects", which is like saying that you
only need shared handles when you need shared handles
(http://www.boost.org/doc/html/threads/rationale.html#threads.rationale.non-copyable.shared.)
I suppose similar argument can be made for movable semantics for
N2184::thread, but again, what about this use case? Does N2184 argue that
this use case does not exist in practice?
Emil Dotchevski
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk