Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-10-08 09:42:17


Alexander Terekhov wrote:
> Peter Dimov wrote:
> [...]
>> My understanding of the two phase business is as follows:
>>
>> Phase 1: search for a handler;
>> Phase 2: unwind to that handler and invoke it, but only if a handler
>> was
>> found.
>
> Yep.
>
>>
>> Extension: a function that performs phase 1 and returns a bool. No
>> rationale (readily) available. Not sure whether, or why, this is a
>> good idea.
>
> I simply have some code (can't change the interface; too late) that
> I'd like to kind "extend":
>
> void operation() {
> bool cancel_expected =
> std::expected_exception<std::thread_cancel_request>();
> /**/
> SOME_LOOP {
> /**/
> if (cancel_expected) std::test_thread_cancel();
> /**/
> }
> /**/
> }
>
> The problem is that some clients have code that invokes it from
> throw()-
> nothing places like d-tors... and don't {always} disable cancelation.
> ;-)

Right. You want to autodetect whether to operate in a throw mode or a
nothrow mode. This will never work. :-)

The problem is that you can't count on people marking nothrow regions
throw() if you can't count on them using operation() correctly (i.e.
disabling cancelation in nothrow regions.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk