This is the mail archive of the
gcc@gcc.gnu.org
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>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 16 Oct 2017 09:25:42 +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> <CA+=ghCh-cE-Zu8hgs8M5Fdzh=6Jh3LuL3gNET69T8o5M7zS=Jg@mail.gmail.com>
ping
On Thu, Aug 31, 2017 at 11:22 AM, Ramón García <ramon.garcia.f@gmail.com> wrote:
> (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"
> https://www.slideshare.net/SergeyPlatonov/gor-nishanov-c-coroutines-a-negative-overhead-abstraction
> Video: https://www.youtube.com/watch?v=_fu0gx-xseY
>
> 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
> asynchronous programming.
>
> 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
> callbacks:
>
> void A()
> {
> a1();
> when event E1 happens, run B
> }
>
> void B()
> {
> b1();
> when event E2 happends, run C
> }
>
> void C()
> {
> c1()
> }
>
> with Coroutines TS this is turned into
>
> void A()
> {
> a1();
> co_await E1;
> b1();
> co_await E2;
> c1();
> }
>
> but have the same efficiency and scalability of asynchronous code.
>
> On Sat, Aug 19, 2017 at 5:49 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> See the thread on gcc-help:
>> https://gcc.gnu.org/ml/gcc-help/2017-08/msg00045.html
>>
>>
>>
>> On 19 August 2017 at 14:09, Ramón García <ramon.garcia.f@gmail.com> wrote:
>>> ping.
>>>
>>> On Tue, Aug 15, 2017 at 2:21 PM, Ramón García <ramon.garcia.f@gmail.com> wrote:
>>>> Hello,
>>>>
>>>> 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
>>>> then.
>>>>
>>>> This is an excellent explanation of the Coroutines TS:
>>>>
>>>> https://www.slideshare.net/SergeyPlatonov/gor-nishanov-c-coroutines-a-negative-overhead-abstraction
>>>>
>>>> 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.