Structured concurrency proposal for C++20

Florian Weimer fweimer at redhat.com
Tue Mar 5 15:21:01 UTC 2019


* Volkan Yazıcı:

> [Quoting from Trio from post
> <https://trio.discourse.group/t/structured-concurrency-proposal-for-c-20/125>
> .]
>
> "There’s a really interesting proposal under consideration for C++20,
> that’s highly relevant to us here: https://wg21.link/p0660 (PDF), draft
> implementation <https://github.com/josuttis/jthread>. According to Herb
> Sutter
> <https://herbsutter.com/2019/02/23/trip-report-winter-iso-c-standards-meeting-kona/>,
> the proposal is “design-approved”, and the hope is that the exact wording
> will be formally approved in July."

I'm not sure this proposal is feasible from an architecture perspective
because it requires duplicating all blocking interfaces.  The proposal
provides this just for a single blocking operation, a modified condition
variable.  This is not sufficient for promptly releasing resources when
a stop request is received, so it does not solve the hard problems
related to thread termination.  A thread can stop waiting on the
condition variable when the stop request comes in, but there is no
mechanism to ensure that the resources that are used to eventually
signal the condition variable are no longer spent.  That operation still
happens unperturbed, and upon completion the signal will simply be
delivered into nothingness.

Thanks,
Florian


More information about the loom-dev mailing list