From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2007-03-21 19:30:58
>> I suppose similar argument can be made for movable semantics for
>> N2184::thread, but again, what about this use case? Does N2184 argue
>> this use case does not exist in practice?
> For this use case, N2184 argues that the use case should be supported
> with a higher-level library which sits non-intrusively on top of
> std::thread. My preferred name for this is std::shared_future (though
> std::tr2::shared_future is a more likely name). shared_future would
> be copyable, multi-joinable, and would deliver both normal and
> exceptional results from an asynchronous job when the shared_future is
> joined with.
> The advantage of putting this functionality in a separate class is
> that it costs space and time.
Assuming that the copyable semantics are commonly useful, is it easier to
build them on top of N2184 than on top of, say pthreads (which has been
ported to Windows too and is therefore competing with N2184 as the base of
such higher level interface)?
Speaking of which, on certain operating systems, pthreads probably is a good
base for implementing the N2184 interface, but that way we're going from
copyable handles to non-copyable handles. And now you're saying I can build
copyable handles interface on top of N2184? I could be missing something
important, but this doesn't make sense to me.
> Peter Dimov and Ion Gaztanaga have both implemented shared ownership
> thread manager objects (i.e. future) on top of boost::thread (non-
> intrusively). I'm extremely grateful for their ground breaking proof
> of concept work showing that we don't need a copyable low level to
> support a copyable higher level.
Proof that it is possible is one thing, but is it trivial?
> And fwiw, N2184::thread delivers a std::thread which I believe has the
> more common motivations for a copyable std::thread: You can return it
> from factory functions and you can put into std::containers. These
> actions will only require movability, not copyability, in C++0X.
You can do all that with shared handles too, even in current STL containers.
I wasn't comparing N2184 to boost::thread, I was comparing it to N2178.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk