[cpp-threads] Thread API interface tweaks

Alexander Terekhov alexander.terekhov at gmail.com
Tue Aug 29 17:02:28 BST 2006


On 8/29/06, Peter Dimov <pdimov at mmltd.net> wrote:
[...]
> A future<R> has three states, empty (!ready()), after set_value (has a value
> of type R) and after set_exception. We can add 'bool has_value() const' to

Rather has_exception(). To me it sounds better in the case of futures
for void functions (with or without throw()-nothing exception specs.)

> detect the second. Inspecting the exception type would be tricky, though.

You know that I'm of opinion that C++ EH/ES needs a thorough overhaul.
Adding extras to support intelligent transportation and
delivery/inspection across threads/contexts would fit nicely. :-)

> You typically want to test for the existence of a base class and not for the
> exact type, and the easiest way to do that is to just write the catch clause
> and let the language do its thing. Out of curiosity, why would you want to
> visit the exception instead of catching it?

Because it's caught already. FWIW, I'd like to visit ordinary active
exceptions on all levels of nesting and even do the same for caught
exceptions inside catch(...) handlers as well (and for the later do it
without rethrow-catch).

regards,
alexander.



More information about the cpp-threads mailing list