This is the mail archive of the
mailing list for the GCC project.
Re: Please support Coroutines TS in C++
- From: Ramón García <ramon dot garcia dot f at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 31 Aug 2017 11:22:17 +0200
- Subject: Re: Please support Coroutines TS in C++
- Authentication-results: sourceware.org; auth=none
- References: <CA+=ghChmBckJOEgQsjsYCQJ7fJao+_mwd+FcPJsNUm=05e9i7A@mail.gmail.com> <CA+=ghCgagKe0Aync2G04tECJWhcqx2Xi-X-uxTciOrZotG+-pQ@mail.gmail.com> <CAH6eHdQgNMMrfLO3Pxvigu38iAsHx43cwF6ZAsUouK9P2wvGAg@mail.gmail.com>
(repeated, forgot to reply to mailing list)
Xi Ruoyao misses completely the point!
The amount of error prone boilerplate code, that the programmer would
have to write, is huge. See examples in the excellent presentation
"C++ coroutines: a negative overhead abstraction"
What one can have with a coroutine library, are stackfull coroutines.
But they are not really useful. Not very scalable. The simplification
of programming has a high cost.
With stackless coroutines, one can combine the simplicity of
sequential programming, with the scalability and efficiency of
Did you ever read Linux kernel code? There is a lot of hand written
code that tries to achieve a sequence of actions using chained
when event E1 happens, run B
when event E2 happends, run C
with Coroutines TS this is turned into
but have the same efficiency and scalability of asynchronous code.
On Sat, Aug 19, 2017 at 5:49 PM, Jonathan Wakely <email@example.com> wrote:
> See the thread on gcc-help:
> On 19 August 2017 at 14:09, Ramón García <firstname.lastname@example.org> wrote:
>> On Tue, Aug 15, 2017 at 2:21 PM, Ramón García <email@example.com> wrote:
>>> Please consider supporting the Coroutines TS in GNU C++.
>>> It is really important to make asynchronous programming usable.
>>> Modern programs should be scalable to use the performance of multicore
>>> processors. Stackless coroutines allow the programmer to scale to
>>> millions of asynchronous requests. But without the primitives in the
>>> Concurrency TS, chaining the result of an asynchronous computation to
>>> the next step, one must program a chain of callbacks. It becomes
>>> quickly unusable.
>>> The promise/future, as specified in the concurrency TS, (that is, with
>>> the function future::then for chaining a callback to the completion of
>>> the future) make asynchronous programming somewhat more usable.
>>> Unfortunately, almost no C++ library shipped supports future with
>>> This is an excellent explanation of the Coroutines TS:
>>> Both Visual C++ 2017 and CLANG (SVN version) support the Coroutines
>>> TS. Please consider it.
>>> I saw that someone started an attempt at implementing it:
>>> https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00435.html but there
>>> were no replies.