Boost logo

Boost Users :

Subject: Re: [Boost-users] State of context and coroutine
From: Michael Steinberg (michsteinb_at_[hidden])
Date: 2016-07-06 03:49:51


> 2016-07-05 20:36 GMT+02:00 Michael Steinberg <michsteinb_at_[hidden]
> <mailto:michsteinb_at_[hidden]>>:
>
> a) not documented
>
>
> http://www.boost.org/doc/libs/1_61_0/libs/coroutine2/doc/html/coroutine2/coroutine/asymmetric.html
> 'Code executed by /coroutine-function/ must not prevent the
> propagation of the /detail::forced_unwind/ exception. Absorbing that
> exception will cause stack unwinding to fail. Thus, any code that
> catches all exceptions must re-throw any pending
> /detail::forced_unwind/ exception.'
Oh well, I should have noted that we're going directly with
context::execution_context now, in whose documentation I could not find
this.
>
> b) the exception is defined in the detail namespace. That means,
> one has to use a detail-member to rethrow the one exception that
> has to leave the coroutine client entry function.
>
>
> do not absorb exception detail::forced_unwind, e.g. do not use
> 'catch(...)'
Can *any* exception *but* detail::forced_unwind leak the coroutine (not
meaning coroutine::*) that is being driven by context::execution_context
without crashing ungracefully? I'm not sure how I could guarantee that
without a pattern like "catch( forced_unwind& ) { throw; } catch ( ... )
{ ... }". But that can very well be the case, because I'm not so very
used to "using" exceptions other than trying my best to write
exception-safe code. I should also say that I would never swallow with
catch( ... ), it's just that here I did not see any other generic solution.

Michael



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net