From: Sam Partington (sam.partington_at_[hidden])
Date: 2006-07-25 05:46:34
On 18/07/06, Sohail Somani <s.somani_at_[hidden]> wrote:
> I just don't see the point, except as an academic exercise
I used a similar technique when I wrote a subset of some of Kevlin
Henney's threading concepts .
I wanted to extend it so exceptions could be propagated from the
thread function to the calling thread. The client code looked like
// code begins...
joiner<std::string> joiner = thread(my_function,
// parallel work here
std::string result = joiner();
joiner::operator() may throw std::runtime_error,
my_app_specific_error, or std::bad_exception if the exception could
not be mapped.
Of course exceptions are sliced, but support could be added for
cloning if the exception hierarchy supported it (through ADL perhaps).
Anyway, I make use of it quite a bit and I've never found the slicing
to be a problem - typically you know what you expect to catch
So I can see at least one non-academic use for it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk