Topic: [RFC] A Joint Thought on Resumable Functions
Author: TONGARI J <tongari95@gmail.com>
Date: Tue, 22 Sep 2015 23:23:05 +0800
Raw View
--089e0111b5e21bd985052057938b
Content-Type: text/plain; charset=UTF-8
2015-09-22 23:14 GMT+08:00 Giovanni Piero Deretta <gpderetta@gmail.com>:
> On Monday, September 21, 2015 at 4:41:30 PM UTC+1, TONGARI J wrote:
>>
>> Hi,
>>
>> Please find the draft here:
>> https://gist.github.com/jamboree/a2b3fe32eeb8c21e820c
>>
>> It's my thoughts on the possible joint of Resumable Functions(N4402) and
>> Resumable Expressions(N4453).
>>
>> To be clear, I'm not gonna write a complete proposal, I just hope the
>> authors and people behind the aforementioned proposals could take the idea
>> into account.
>>
>> Any feedback is welcome.
>>
>
> From the document:
>
> "In yield-first approach, however, there's no way to make the coroutine
> ready-to-suspend before it is really suspended. To prevent the coroutine
> from being resumed before it is suspended, sychronization is needed, which
> imposes some runtime overhead that the await-first approach is free from. "
>
> That doesn't seem right to me and doesn't match my experience. It is
> certainly possible to suspend the coroutine and then start the operation
> from inside the async function given a rich enough interface. Can you
> expand on it?
>
What rich enough interface would it be? AFAIK, Resumable Expressions only
has `break resumable` which is a simple yield. And Boost.Coroutine doesn't
seem to have an API that interface you have in mind.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--089e0111b5e21bd985052057938b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2015=
-09-22 23:14 GMT+08:00 Giovanni Piero Deretta <span dir=3D"ltr"><<a href=
=3D"mailto:gpderetta@gmail.com" target=3D"_blank">gpderetta@gmail.com</a>&g=
t;</span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left=
-style:solid;padding-left:1ex"><div class=3D""><div class=3D"h5">On Monday,=
September 21, 2015 at 4:41:30 PM UTC+1, TONGARI J wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;bo=
rder-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">=
<div dir=3D"ltr">Hi,<div><br></div><div>Please find the draft here:</div><d=
iv><a href=3D"https://gist.github.com/jamboree/a2b3fe32eeb8c21e820c" rel=3D=
"nofollow" target=3D"_blank">https://gist.github.com/jamboree/a2b3fe32eeb8c=
21e820c</a><br></div><div><br></div>It's my thoughts on the possible jo=
int of Resumable Functions(N4402) and Resumable Expressions(N4453).<div><br=
></div><div>To be clear, I'm not gonna write a complete proposal, I jus=
t hope the authors and people behind the aforementioned proposals could tak=
e the idea into account.</div><br>Any feedback is welcome.</div></blockquot=
e></div></div><div><br>From the document:<br><br>"In yield-first appro=
ach, however, there's no way to make the coroutine=20
ready-to-suspend before it is really suspended. To prevent the coroutine
from being resumed before it is suspended, sychronization is needed,=20
which imposes some runtime overhead that the await-first approach is=20
free from. "<br><br>That doesn't seem right to me and doesn't =
match my experience. It is certainly possible to suspend the coroutine and =
then start the operation from inside the async function given a rich enough=
interface. Can you expand on it?=C2=A0</div></blockquote><div><br></div><d=
iv>What rich enough interface would it be? AFAIK, Resumable Expressions onl=
y has `break resumable` which is a simple yield. And Boost.Coroutine doesn&=
#39;t seem to have an API that=C2=A0interface you have in mind.</div></div>=
</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--089e0111b5e21bd985052057938b--
.
Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Tue, 22 Sep 2015 08:37:22 -0700 (PDT)
Raw View
------=_Part_624_1479485202.1442936242297
Content-Type: multipart/alternative;
boundary="----=_Part_625_1900005281.1442936242297"
------=_Part_625_1900005281.1442936242297
Content-Type: text/plain; charset=UTF-8
On Tuesday, September 22, 2015 at 4:23:07 PM UTC+1, TONGARI J wrote:
>
> 2015-09-22 23:14 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com
> <javascript:>>:
>
>> On Monday, September 21, 2015 at 4:41:30 PM UTC+1, TONGARI J wrote:
>>>
>>> Hi,
>>>
>>> Please find the draft here:
>>> https://gist.github.com/jamboree/a2b3fe32eeb8c21e820c
>>>
>>> It's my thoughts on the possible joint of Resumable Functions(N4402) and
>>> Resumable Expressions(N4453).
>>>
>>> To be clear, I'm not gonna write a complete proposal, I just hope the
>>> authors and people behind the aforementioned proposals could take the idea
>>> into account.
>>>
>>> Any feedback is welcome.
>>>
>>
>> From the document:
>>
>> "In yield-first approach, however, there's no way to make the coroutine
>> ready-to-suspend before it is really suspended. To prevent the coroutine
>> from being resumed before it is suspended, sychronization is needed, which
>> imposes some runtime overhead that the await-first approach is free from. "
>>
>> That doesn't seem right to me and doesn't match my experience. It is
>> certainly possible to suspend the coroutine and then start the operation
>> from inside the async function given a rich enough interface. Can you
>> expand on it?
>>
>
> What rich enough interface would it be? AFAIK, Resumable Expressions only
> has `break resumable` which is a simple yield. And Boost.Coroutine doesn't
> seem to have an API that interface you have in mind.
>
It can be implemented in boost.coroutine by passing to the other context an
std::function [1] to execute right after resumption. A more efficient
implementation could just construct a stack frame on top of the context to
be yielded to.
-- gpd
[1] Note: no allocation is required as the callback object itself can live
inside the just suspended coroutine stack frame and the std::function can
be initialized with a reference wrapper.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_625_1900005281.1442936242297
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Tuesday, September 22, 2015 at 4:23:07 PM UTC+1, TONGARI J wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div class=3D"g=
mail_quote">2015-09-22 23:14 GMT+08:00 Giovanni Piero Deretta <span dir=3D"=
ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D=
"-ltDerwRBgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:=
';return true;" onclick=3D"this.href=3D'javascript:';return tru=
e;">gpde...@gmail.com</a>></span>:<br><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:r=
gb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>On Mond=
ay, September 21, 2015 at 4:41:30 PM UTC+1, TONGARI J wrote:<blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;=
border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex=
"><div dir=3D"ltr">Hi,<div><br></div><div>Please find the draft here:</div>=
<div><a href=3D"https://gist.github.com/jamboree/a2b3fe32eeb8c21e820c" rel=
=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D'https://www=
..google.com/url?q\75https%3A%2F%2Fgist.github.com%2Fjamboree%2Fa2b3fe32eeb8=
c21e820c\46sa\75D\46sntz\0751\46usg\75AFQjCNHJ3aVyiSk4aYnbiZV8XxnunUhhUA=
9;;return true;" onclick=3D"this.href=3D'https://www.google.com/url?q\7=
5https%3A%2F%2Fgist.github.com%2Fjamboree%2Fa2b3fe32eeb8c21e820c\46sa\75D\4=
6sntz\0751\46usg\75AFQjCNHJ3aVyiSk4aYnbiZV8XxnunUhhUA';return true;">ht=
tps://gist.github.com/<wbr>jamboree/a2b3fe32eeb8c21e820c</a><br></div><div>=
<br></div>It's my thoughts on the possible joint of Resumable Functions=
(N4402) and Resumable Expressions(N4453).<div><br></div><div>To be clear, I=
'm not gonna write a complete proposal, I just hope the authors and peo=
ple behind the aforementioned proposals could take the idea into account.</=
div><br>Any feedback is welcome.</div></blockquote></div></div><div><br>Fro=
m the document:<br><br>"In yield-first approach, however, there's =
no way to make the coroutine=20
ready-to-suspend before it is really suspended. To prevent the coroutine
from being resumed before it is suspended, sychronization is needed,=20
which imposes some runtime overhead that the await-first approach is=20
free from. "<br><br>That doesn't seem right to me and doesn't =
match my experience. It is certainly possible to suspend the coroutine and =
then start the operation from inside the async function given a rich enough=
interface. Can you expand on it?=C2=A0</div></blockquote><div><br></div><d=
iv>What rich enough interface would it be? AFAIK, Resumable Expressions onl=
y has `break resumable` which is a simple yield. And Boost.Coroutine doesn&=
#39;t seem to have an API that=C2=A0interface you have in mind.</div></div>=
</div></div></blockquote><div><br>It can be implemented in boost.coroutine =
by passing to the other context an std::function [1] to execute right after=
resumption. A more efficient implementation could just construct a stack f=
rame on top of the context to be yielded to.<br><br>-- gpd<br><br>[1] Note:=
no allocation is required as the callback object itself can live inside th=
e just suspended coroutine stack frame and the std::function=C2=A0 can be i=
nitialized with a reference wrapper.<br>=C2=A0</div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_625_1900005281.1442936242297--
------=_Part_624_1479485202.1442936242297--
.
Author: TONGARI J <tongari95@gmail.com>
Date: Wed, 23 Sep 2015 00:23:31 +0800
Raw View
--047d7bd74b823632340520586ba6
Content-Type: text/plain; charset=UTF-8
2015-09-22 23:37 GMT+08:00 Giovanni Piero Deretta <gpderetta@gmail.com>:
> On Tuesday, September 22, 2015 at 4:23:07 PM UTC+1, TONGARI J wrote:
>>
>> 2015-09-22 23:14 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com>:
>>
>>> On Monday, September 21, 2015 at 4:41:30 PM UTC+1, TONGARI J wrote:
>>>>
>>>> Hi,
>>>>
>>>> Please find the draft here:
>>>> https://gist.github.com/jamboree/a2b3fe32eeb8c21e820c
>>>>
>>>> It's my thoughts on the possible joint of Resumable Functions(N4402)
>>>> and Resumable Expressions(N4453).
>>>>
>>>> To be clear, I'm not gonna write a complete proposal, I just hope the
>>>> authors and people behind the aforementioned proposals could take the idea
>>>> into account.
>>>>
>>>> Any feedback is welcome.
>>>>
>>>
>>> From the document:
>>>
>>> "In yield-first approach, however, there's no way to make the coroutine
>>> ready-to-suspend before it is really suspended. To prevent the coroutine
>>> from being resumed before it is suspended, sychronization is needed, which
>>> imposes some runtime overhead that the await-first approach is free from. "
>>>
>>> That doesn't seem right to me and doesn't match my experience. It is
>>> certainly possible to suspend the coroutine and then start the operation
>>> from inside the async function given a rich enough interface. Can you
>>> expand on it?
>>>
>>
>> What rich enough interface would it be? AFAIK, Resumable Expressions only
>> has `break resumable` which is a simple yield. And Boost.Coroutine doesn't
>> seem to have an API that interface you have in mind.
>>
>
> It can be implemented in boost.coroutine by passing to the other context
> an std::function [1] to execute right after resumption. A more efficient
> implementation could just construct a stack frame on top of the context to
> be yielded to.
>
It's not clear to me what that means. A sample code may help.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--047d7bd74b823632340520586ba6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2015=
-09-22 23:37 GMT+08:00 Giovanni Piero Deretta <span dir=3D"ltr"><<a href=
=3D"mailto:gpderetta@gmail.com" target=3D"_blank">gpderetta@gmail.com</a>&g=
t;</span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex">On Tuesday, September 22, 2015=
at 4:23:07 PM UTC+1, TONGARI J wrote:<span class=3D""><blockquote class=3D=
"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc soli=
d;padding-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote">2015-0=
9-22 23:14 GMT+08:00 Giovanni Piero Deretta <span dir=3D"ltr"><<a rel=3D=
"nofollow">gpde...@gmail.com</a>></span>:<br><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-=
color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>=
On Monday, September 21, 2015 at 4:41:30 PM UTC+1, TONGARI J wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-wid=
th:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-l=
eft:1ex"><div dir=3D"ltr">Hi,<div><br></div><div>Please find the draft here=
:</div><div><a href=3D"https://gist.github.com/jamboree/a2b3fe32eeb8c21e820=
c" rel=3D"nofollow" target=3D"_blank">https://gist.github.com/jamboree/a2b3=
fe32eeb8c21e820c</a><br></div><div><br></div>It's my thoughts on the po=
ssible joint of Resumable Functions(N4402) and Resumable Expressions(N4453)=
..<div><br></div><div>To be clear, I'm not gonna write a complete propos=
al, I just hope the authors and people behind the aforementioned proposals =
could take the idea into account.</div><br>Any feedback is welcome.</div></=
blockquote></div></div><div><br>From the document:<br><br>"In yield-fi=
rst approach, however, there's no way to make the coroutine=20
ready-to-suspend before it is really suspended. To prevent the coroutine
from being resumed before it is suspended, sychronization is needed,=20
which imposes some runtime overhead that the await-first approach is=20
free from. "<br><br>That doesn't seem right to me and doesn't =
match my experience. It is certainly possible to suspend the coroutine and =
then start the operation from inside the async function given a rich enough=
interface. Can you expand on it?=C2=A0</div></blockquote><div><br></div><d=
iv>What rich enough interface would it be? AFAIK, Resumable Expressions onl=
y has `break resumable` which is a simple yield. And Boost.Coroutine doesn&=
#39;t seem to have an API that=C2=A0interface you have in mind.</div></div>=
</div></div></blockquote></span><div><br>It can be implemented in boost.cor=
outine by passing to the other context an std::function [1] to execute righ=
t after resumption. A more efficient implementation could just construct a =
stack frame on top of the context to be yielded to.</div></blockquote><div>=
<br></div><div>It's not clear to me what that means. A sample code may =
help.=C2=A0</div></div></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--047d7bd74b823632340520586ba6--
.
Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Tue, 22 Sep 2015 23:01:18 +0100
Raw View
On Tue, Sep 22, 2015 at 5:23 PM, TONGARI J <tongari95@gmail.com> wrote:
> 2015-09-22 23:37 GMT+08:00 Giovanni Piero Deretta <gpderetta@gmail.com>:
>>
>> On Tuesday, September 22, 2015 at 4:23:07 PM UTC+1, TONGARI J wrote:
>>>
>>> 2015-09-22 23:14 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com>:
>>>>
>>>> On Monday, September 21, 2015 at 4:41:30 PM UTC+1, TONGARI J wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Please find the draft here:
>>>>> https://gist.github.com/jamboree/a2b3fe32eeb8c21e820c
>>>>>
>>>>> It's my thoughts on the possible joint of Resumable Functions(N4402)
>>>>> and Resumable Expressions(N4453).
>>>>>
>>>>> To be clear, I'm not gonna write a complete proposal, I just hope the
>>>>> authors and people behind the aforementioned proposals could take the idea
>>>>> into account.
>>>>>
>>>>> Any feedback is welcome.
>>>>
>>>>
>>>> From the document:
>>>>
>>>> "In yield-first approach, however, there's no way to make the coroutine
>>>> ready-to-suspend before it is really suspended. To prevent the coroutine
>>>> from being resumed before it is suspended, sychronization is needed, which
>>>> imposes some runtime overhead that the await-first approach is free from. "
>>>>
>>>> That doesn't seem right to me and doesn't match my experience. It is
>>>> certainly possible to suspend the coroutine and then start the operation
>>>> from inside the async function given a rich enough interface. Can you expand
>>>> on it?
>>>
>>>
>>> What rich enough interface would it be? AFAIK, Resumable Expressions only
>>> has `break resumable` which is a simple yield. And Boost.Coroutine doesn't
>>> seem to have an API that interface you have in mind.
>>
>>
>> It can be implemented in boost.coroutine by passing to the other context
>> an std::function [1] to execute right after resumption. A more efficient
>> implementation could just construct a stack frame on top of the context to
>> be yielded to.
>
>
> It's not clear to me what that means. A sample code may help.
>
(this is not necessarily boost coroutine syntax, but should be close enough)
template<class T>
struct task;
using callbak = std::function<void(task&&)> ;
struct task : private coroutine<callback(callback)>
{
using coroutine::coroutine;
using coroutine::operator=;
void operator() () {
callback c;
c = coroutine::operator()(std::move(c));
if (c) c(std::move(*this);
}
template<class F>
void yield_with(F&& f)
{
callback c (std::ref(f));
c = coroutine::operator()(std::move(c));
if (c) c(std::move(*this);
}
} ;
// usage:
template<class F>
void async_write(std::vector<char>&, F);
.....
my_coroutine(task& scheduler) {
std::vector<char> v;
scheduler.yield_with([&] (task& self) { async_write(v, self); });
}
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: TONGARI J <tongari95@gmail.com>
Date: Wed, 23 Sep 2015 10:49:36 +0800
Raw View
--001a113f921e4931d40520612ab9
Content-Type: text/plain; charset=UTF-8
2015-09-23 6:01 GMT+08:00 Giovanni Piero Deretta <gpderetta@gmail.com>:
>
> (this is not necessarily boost coroutine syntax, but should be close
> enough)
>
> template<class T>
> struct task;
> using callbak = std::function<void(task&&)> ;
> struct task : private coroutine<callback(callback)>
> {
> using coroutine::coroutine;
> using coroutine::operator=;
>
> void operator() () {
> callback c;
> c = coroutine::operator()(std::move(c));
> if (c) c(std::move(*this);
> }
>
> template<class F>
> void yield_with(F&& f)
> {
> callback c (std::ref(f));
> c = coroutine::operator()(std::move(c));
> if (c) c(std::move(*this);
> }
>
>
> } ;
>
> // usage:
> template<class F>
> void async_write(std::vector<char>&, F);
>
> ....
> my_coroutine(task& scheduler) {
>
> std::vector<char> v;
> scheduler.yield_with([&] (task& self) { async_write(v, self); });
>
>
> }
>
What's done in coroutine? what's the relation between the callback you pass
in and the one it returns?
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--001a113f921e4931d40520612ab9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2015=
-09-23 6:01 GMT+08:00 Giovanni Piero Deretta <span dir=3D"ltr"><<a href=
=3D"mailto:gpderetta@gmail.com" target=3D"_blank">gpderetta@gmail.com</a>&g=
t;</span>:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-sty=
le:solid;padding-left:1ex">(this is not necessarily boost coroutine syntax,=
but should be close enough)<br>
<br>
template<class T><br>
struct task;<br>
using callbak =3D std::function<void(task&&)> ;<br>
struct task : private coroutine<callback(callback)><br>
{<br>
using coroutine::coroutine;<br>
using coroutine::operator=3D;<br>
<br>
void operator() () {<br>
=C2=A0 =C2=A0 =C2=A0callback c;<br>
=C2=A0 =C2=A0 =C2=A0c =3D coroutine::operator()(std::move(c));<br>
=C2=A0 =C2=A0 =C2=A0if (c) c(std::move(*this);<br>
}<br>
<br>
template<class F><br>
void yield_with(F&& f)<br>
{<br>
=C2=A0 =C2=A0 =C2=A0callback c (std::ref(f));<br>
=C2=A0 =C2=A0 =C2=A0c =3D coroutine::operator()(std::move(c));<br>
=C2=A0 =C2=A0 =C2=A0if (c) c(std::move(*this);<br>
}<br>
<br>
<br>
} ;<br>
<br>
// usage:<br>
template<class F><br>
void async_write(std::vector<char>&, F);<br>
<br>
.....<br>
my_coroutine(task& scheduler) {<br>
<br>
std::vector<char> v;<br>
scheduler.yield_with([&] (task& self) { async_write(v, self); });<b=
r>
<div class=3D""><div class=3D"h5"><br>
<br>
}<br></div></div></blockquote><div><br></div><div>What's done in corout=
ine? what's the relation between the callback you pass in and the one i=
t returns?</div></div></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a113f921e4931d40520612ab9--
.
Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Wed, 23 Sep 2015 02:43:07 -0700 (PDT)
Raw View
------=_Part_7425_1194092662.1443001387641
Content-Type: multipart/alternative;
boundary="----=_Part_7426_1806918432.1443001387641"
------=_Part_7426_1806918432.1443001387641
Content-Type: text/plain; charset=UTF-8
On Wednesday, September 23, 2015 at 3:49:38 AM UTC+1, TONGARI J wrote:
>
> 2015-09-23 6:01 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com
> <javascript:>>:
>>
>> (this is not necessarily boost coroutine syntax, but should be close
>> enough)
>
> [snip]
>
>
> What's done in coroutine?
>
What do you mean with this? Boost.Coroutine itself doesn't do the callback
passing by itself, but as shown above it can be easily implemented on top
of it. Of course an implementation built in the coroutine library can be
more performant. as you wouldn't pay for the feature unless you explicitly
need it.
> What's the relation between the callback you pass in and the one it
> returns?
>
coroutine L passes to coroutine R the callback C_l it want to be executed
and, symmetrically, it executes the callback C_r it got from coroutine R.
C_l is executed on R context and get passed L as a parameter and vice-versa.
-- gpd
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_7426_1806918432.1443001387641
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Wednesday, September 23, 2015 at 3:49:38 AM UTC+1, TONGARI J wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div class=3D=
"gmail_quote">2015-09-23 6:01 GMT+08:00 Giovanni Piero Deretta <span dir=3D=
"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=
=3D"ZocjAjM3BgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascri=
pt:';return true;" onclick=3D"this.href=3D'javascript:';return =
true;">gpde...@gmail.com</a>></span>:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rg=
b(204,204,204);border-left-style:solid;padding-left:1ex">(this is not neces=
sarily boost coroutine syntax, but should be close enough)</blockquote></di=
v></div></div></blockquote>[snip]<blockquote class=3D"gmail_quote" style=3D=
"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex=
;"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div><br></div><div>Wha=
t's done in coroutine?=C2=A0</div></div></div></div></blockquote><div><=
br>What do you mean with this? Boost.Coroutine itself doesn't do the ca=
llback passing by itself, but as shown above it can be easily implemented o=
n top of it. Of course an implementation built in the coroutine library ca=
n be more performant. as you wouldn't pay for the feature unless you ex=
plicitly need it.<br><br><blockquote class=3D"gmail_quote" style=3D"margin:=
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div =
dir=3D"ltr"><div><div class=3D"gmail_quote"><div><br></div><div>What's =
the relation between the callback you pass in and the one it returns?</div>=
</div></div></div></blockquote><br>coroutine L passes to coroutine R the ca=
llback C_l it want to be executed and, symmetrically, it executes the callb=
ack C_r it got from=C2=A0 coroutine R.<br><br>C_l is executed on R context =
and get passed L as a parameter and vice-versa.<br><br>-- gpd<br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_7426_1806918432.1443001387641--
------=_Part_7425_1194092662.1443001387641--
.
Author: TONGARI J <tongari95@gmail.com>
Date: Wed, 23 Sep 2015 22:19:19 +0800
Raw View
--001a113f921ee4d1f005206acce0
Content-Type: text/plain; charset=UTF-8
2015-09-23 17:43 GMT+08:00 Giovanni Piero Deretta <gpderetta@gmail.com>:
> On Wednesday, September 23, 2015 at 3:49:38 AM UTC+1, TONGARI J wrote:
>>
>> 2015-09-23 6:01 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com>:
>>>
>>> (this is not necessarily boost coroutine syntax, but should be close
>>> enough)
>>
>> [snip]
>>
>>
>> What's done in coroutine?
>>
>
> What do you mean with this? Boost.Coroutine itself doesn't do the callback
> passing by itself, but as shown above it can be easily implemented on top
> of it. Of course an implementation built in the coroutine library can be
> more performant. as you wouldn't pay for the feature unless you explicitly
> need it.
>
With Boost.Coroutine, we'll pass a function for it to execute on
construction, but I don't see anything like that in your code, not even an
assignment to the coroutine base.
> What's the relation between the callback you pass in and the one it
>> returns?
>>
>
> coroutine L passes to coroutine R the callback C_l it want to be executed
> and, symmetrically, it executes the callback C_r it got from coroutine R.
>
> C_l is executed on R context and get passed L as a parameter and
> vice-versa.
>
Are you saying that you're spawing 2 coroutines for that? I only see one,
the one you pass to `my_coroutine(task& scheduler)`. What am I missing?
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--001a113f921ee4d1f005206acce0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">2015-09-23 17:43 GMT+08:00 Giovanni Piero Deretta <span dir=3D"ltr"><=
;<a href=3D"mailto:gpderetta@gmail.com" target=3D"_blank">gpderetta@gmail.c=
om</a>></span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px=
0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);bor=
der-left-style:solid;padding-left:1ex">On Wednesday, September 23, 2015 at =
3:49:38 AM UTC+1, TONGARI J wrote:<span class=3D""><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-le=
ft-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div di=
r=3D"ltr"><div><div class=3D"gmail_quote">2015-09-23 6:01 GMT+08:00 Giovann=
i Piero Deretta <span dir=3D"ltr"><<a rel=3D"nofollow">gpde...@gmail.com=
</a>></span>:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-le=
ft-style:solid;padding-left:1ex">(this is not necessarily boost coroutine s=
yntax, but should be close enough)</blockquote></div></div></div></blockquo=
te></span>[snip]<span class=3D""><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,2=
04,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"><div><di=
v class=3D"gmail_quote"><div><br></div><div>What's done in coroutine?=
=C2=A0</div></div></div></div></blockquote></span><div><br>What do you mean=
with this? Boost.Coroutine itself doesn't do the callback passing by i=
tself, but as shown above it can be easily implemented on top of it. Of cou=
rse an implementation built in the coroutine library can be more performan=
t. as you wouldn't pay for the feature unless you explicitly need it.<b=
r></div></blockquote><div><br></div><div>With Boost.Coroutine, we'll pa=
ss a function for it to execute on construction, but I don't see anythi=
ng like that in your code, not even an assignment to the coroutine base.</d=
iv><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);borde=
r-left-style:solid;padding-left:1ex"><div><blockquote class=3D"gmail_quote"=
style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:=
rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"=
><div><div class=3D"gmail_quote"><div></div><div>What's the relation be=
tween the callback you pass in and the one it returns?</div></div></div></d=
iv></blockquote><br>coroutine L passes to coroutine R the callback C_l it w=
ant to be executed and, symmetrically, it executes the callback C_r it got =
from=C2=A0 coroutine R.<br><br>C_l is executed on R context and get passed =
L as a parameter and vice-versa.</div></blockquote><div><br></div><div>Are =
you saying that you're spawing 2 coroutines for that? I only see one, t=
he one you pass to `my_coroutine(task& scheduler)`. What am I missing?<=
/div></div></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a113f921ee4d1f005206acce0--
.
Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Wed, 23 Sep 2015 07:31:06 -0700 (PDT)
Raw View
------=_Part_7079_1130840010.1443018666797
Content-Type: multipart/alternative;
boundary="----=_Part_7080_1660669900.1443018666797"
------=_Part_7080_1660669900.1443018666797
Content-Type: text/plain; charset=UTF-8
On Wednesday, September 23, 2015 at 3:19:21 PM UTC+1, TONGARI J wrote:
>
>
>
> 2015-09-23 17:43 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com
> <javascript:>>:
>
>> On Wednesday, September 23, 2015 at 3:49:38 AM UTC+1, TONGARI J wrote:
>>>
>>> 2015-09-23 6:01 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com>:
>>>>
>>>> (this is not necessarily boost coroutine syntax, but should be close
>>>> enough)
>>>
>>> [snip]
>>>
>>>
>>> What's done in coroutine?
>>>
>>
>> What do you mean with this? Boost.Coroutine itself doesn't do the
>> callback passing by itself, but as shown above it can be easily implemented
>> on top of it. Of course an implementation built in the coroutine library
>> can be more performant. as you wouldn't pay for the feature unless you
>> explicitly need it.
>>
>
> With Boost.Coroutine, we'll pass a function for it to execute on
> construction, but I don't see anything like that in your code, not even an
> assignment to the coroutine base.
>
The task wrapper imports the coroutine constructor via 'using', so all the
constructors (and operator=) have all the same semantics as for
boost.coroutine.
>
>
>> What's the relation between the callback you pass in and the one it
>>> returns?
>>>
>>
>> coroutine L passes to coroutine R the callback C_l it want to be executed
>> and, symmetrically, it executes the callback C_r it got from coroutine R.
>>
>> C_l is executed on R context and get passed L as a parameter and
>> vice-versa.
>>
>
> Are you saying that you're spawing 2 coroutines for that? I only see one,
> the one you pass to `my_coroutine(task& scheduler)`. What am I missing?
>
the my_coroutine function is of course running inside a coroutine (let's
call it, improperly, my_coroutine). 'scheduler' is another coroutine,
either the next in line in execution once my_coroutine yield or a special
coroutine that runs the scheduler to pick up the next (this is immaterial
for the example). On the call to scheduler.yield_with, the my_coroutine,
which is currently running, is suspended, the scheduler coroutine is
activated and then the lambda callaback is invoked from inside 'scheduler'.
Inside the lambda 'self' refers to the 'my_coroutine' that was just
suspended.
-- gpd
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_7080_1660669900.1443018666797
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Wednesday, September 23, 2015 at 3:19:21 PM UTC+1, TONGARI J wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><div><br><div =
class=3D"gmail_quote">2015-09-23 17:43 GMT+08:00 Giovanni Piero Deretta <sp=
an dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated=
-mailto=3D"uYJSMNZcBgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'j=
avascript:';return true;" onclick=3D"this.href=3D'javascript:';=
return true;">gpde...@gmail.com</a>></span>:<br><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-le=
ft-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On Wedn=
esday, September 23, 2015 at 3:49:38 AM UTC+1, TONGARI J wrote:<span><block=
quote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-w=
idth:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding=
-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote">2015-09-23 6:01=
GMT+08:00 Giovanni Piero Deretta <span dir=3D"ltr"><<a rel=3D"nofollow"=
>gpde...@gmail.com</a>></span>:<blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(20=
4,204,204);border-left-style:solid;padding-left:1ex">(this is not necessari=
ly boost coroutine syntax, but should be close enough)</blockquote></div></=
div></div></blockquote></span>[snip]<span><blockquote class=3D"gmail_quote"=
style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:=
rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"=
><div><div class=3D"gmail_quote"><div><br></div><div>What's done in cor=
outine?=C2=A0</div></div></div></div></blockquote></span><div><br>What do y=
ou mean with this? Boost.Coroutine itself doesn't do the callback passi=
ng by itself, but as shown above it can be easily implemented on top of it.=
Of course an implementation built in the coroutine library can be more pe=
rformant. as you wouldn't pay for the feature unless you explicitly nee=
d it.<br></div></blockquote><div><br></div><div>With Boost.Coroutine, we=
9;ll pass a function for it to execute on construction, but I don't see=
anything like that in your code, not even an assignment to the coroutine b=
ase.</div></div></div></div></blockquote><div><br>The task wrapper imports =
the coroutine constructor via 'using', so all the constructors (and=
operator=3D) have all the same semantics as for boost.coroutine.<br>=C2=A0=
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><d=
iv class=3D"gmail_quote"><div>=C2=A0</div><blockquote class=3D"gmail_quote"=
style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:=
rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><blockquote=
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:=
1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left=
:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div></div><div>What=
's the relation between the callback you pass in and the one it returns=
?</div></div></div></div></blockquote><br>coroutine L passes to coroutine R=
the callback C_l it want to be executed and, symmetrically, it executes th=
e callback C_r it got from=C2=A0 coroutine R.<br><br>C_l is executed on R c=
ontext and get passed L as a parameter and vice-versa.</div></blockquote><d=
iv><br></div><div>Are you saying that you're spawing 2 coroutines for t=
hat? I only see one, the one you pass to `my_coroutine(task& scheduler)=
`. What am I missing?</div></div></div></div></blockquote><div><br>the my_c=
oroutine function is of course running inside a coroutine (let's call i=
t, improperly, my_coroutine). 'scheduler' is another coroutine, eit=
her the next in line in execution once my_coroutine yield or a special coro=
utine that runs the scheduler to pick up the next (this is immaterial for t=
he example). On the call to scheduler.yield_with, the my_coroutine, which i=
s currently running, is suspended, the scheduler coroutine is activated and=
then the lambda callaback is invoked from inside 'scheduler'. Insi=
de the lambda 'self' refers to the 'my_coroutine' that was =
just suspended.<br><br>-- gpd<br><br>=C2=A0</div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_7080_1660669900.1443018666797--
------=_Part_7079_1130840010.1443018666797--
.
Author: TONGARI J <tongari95@gmail.com>
Date: Thu, 24 Sep 2015 00:02:00 +0800
Raw View
--089e0111b5e220663105206c3c1e
Content-Type: text/plain; charset=UTF-8
2015-09-23 22:31 GMT+08:00 Giovanni Piero Deretta <gpderetta@gmail.com>:
> On Wednesday, September 23, 2015 at 3:19:21 PM UTC+1, TONGARI J wrote:
>>
>>
>>
>> 2015-09-23 17:43 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com>:
>>
>>> On Wednesday, September 23, 2015 at 3:49:38 AM UTC+1, TONGARI J wrote:
>>>>
>>>> 2015-09-23 6:01 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com>:
>>>>>
>>>>> (this is not necessarily boost coroutine syntax, but should be close
>>>>> enough)
>>>>
>>>> [snip]
>>>>
>>>>
>>>> What's done in coroutine?
>>>>
>>>
>>> What do you mean with this? Boost.Coroutine itself doesn't do the
>>> callback passing by itself, but as shown above it can be easily implemented
>>> on top of it. Of course an implementation built in the coroutine library
>>> can be more performant. as you wouldn't pay for the feature unless you
>>> explicitly need it.
>>>
>>
>> With Boost.Coroutine, we'll pass a function for it to execute on
>> construction, but I don't see anything like that in your code, not even an
>> assignment to the coroutine base.
>>
>
> The task wrapper imports the coroutine constructor via 'using', so all the
> constructors (and operator=) have all the same semantics as for
> boost.coroutine.
>
>
>>
>>
>>> What's the relation between the callback you pass in and the one it
>>>> returns?
>>>>
>>>
>>> coroutine L passes to coroutine R the callback C_l it want to be
>>> executed and, symmetrically, it executes the callback C_r it got from
>>> coroutine R.
>>>
>>> C_l is executed on R context and get passed L as a parameter and
>>> vice-versa.
>>>
>>
>> Are you saying that you're spawing 2 coroutines for that? I only see one,
>> the one you pass to `my_coroutine(task& scheduler)`. What am I missing?
>>
>
> the my_coroutine function is of course running inside a coroutine (let's
> call it, improperly, my_coroutine). 'scheduler' is another coroutine,
> either the next in line in execution once my_coroutine yield or a special
> coroutine that runs the scheduler to pick up the next (this is immaterial
> for the example). On the call to scheduler.yield_with, the my_coroutine,
> which is currently running, is suspended, the scheduler coroutine is
> activated and then the lambda callaback is invoked from inside 'scheduler'.
> Inside the lambda 'self' refers to the 'my_coroutine' that was just
> suspended.
>
Oh, I think I started to get the idea. The flow is basically:
1. Register the continuation
2. Suspend the coroutine
3. Call the continuation that starts the async op
Right?
My claim was based on the naive use of yield (e.g. the pattern that
asio+boost.coroutine exposes).
I'll remove the reasoning about the inability of yield, which is due to my
lack of imagination.
Thanks for the explanation.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--089e0111b5e220663105206c3c1e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2015=
-09-23 22:31 GMT+08:00 Giovanni Piero Deretta <span dir=3D"ltr"><<a href=
=3D"mailto:gpderetta@gmail.com" target=3D"_blank">gpderetta@gmail.com</a>&g=
t;</span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left=
-style:solid;padding-left:1ex">On Wednesday, September 23, 2015 at 3:19:21 =
PM UTC+1, TONGARI J wrote:<span class=3D""><blockquote class=3D"gmail_quote=
" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color=
:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr=
"><br><div><br><div class=3D"gmail_quote">2015-09-23 17:43 GMT+08:00 Giovan=
ni Piero Deretta <span dir=3D"ltr"><<a rel=3D"nofollow">gpde...@gmail.co=
m</a>></span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);bord=
er-left-style:solid;padding-left:1ex">On Wednesday, September 23, 2015 at 3=
:49:38 AM UTC+1, TONGARI J wrote:<span><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb=
(204,204,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"><d=
iv><div class=3D"gmail_quote">2015-09-23 6:01 GMT+08:00 Giovanni Piero Dere=
tta <span dir=3D"ltr"><<a rel=3D"nofollow">gpde...@gmail.com</a>></sp=
an>:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:sol=
id;padding-left:1ex">(this is not necessarily boost coroutine syntax, but s=
hould be close enough)</blockquote></div></div></div></blockquote></span>[s=
nip]<span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-sty=
le:solid;padding-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote"=
><div><br></div><div>What's done in coroutine?=C2=A0</div></div></div><=
/div></blockquote></span><div><br>What do you mean with this? Boost.Corouti=
ne itself doesn't do the callback passing by itself, but as shown above=
it can be easily implemented on top of it. Of course an implementation bu=
ilt in the coroutine library can be more performant. as you wouldn't pa=
y for the feature unless you explicitly need it.<br></div></blockquote><div=
><br></div><div>With Boost.Coroutine, we'll pass a function for it to e=
xecute on construction, but I don't see anything like that in your code=
, not even an assignment to the coroutine base.</div></div></div></div></bl=
ockquote></span><div><br>The task wrapper imports the coroutine constructor=
via 'using', so all the constructors (and operator=3D) have all th=
e same semantics as for boost.coroutine.<br>=C2=A0</div><span class=3D""><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;pad=
ding-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div>=C2=A0=
</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:s=
olid;padding-left:1ex"><div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,20=
4);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"><div><div cla=
ss=3D"gmail_quote"><div></div><div>What's the relation between the call=
back you pass in and the one it returns?</div></div></div></div></blockquot=
e><br>coroutine L passes to coroutine R the callback C_l it want to be exec=
uted and, symmetrically, it executes the callback C_r it got from=C2=A0 cor=
outine R.<br><br>C_l is executed on R context and get passed L as a paramet=
er and vice-versa.</div></blockquote><div><br></div><div>Are you saying tha=
t you're spawing 2 coroutines for that? I only see one, the one you pas=
s to `my_coroutine(task& scheduler)`. What am I missing?</div></div></d=
iv></div></blockquote></span><div><br>the my_coroutine function is of cours=
e running inside a coroutine (let's call it, improperly, my_coroutine).=
'scheduler' is another coroutine, either the next in line in execu=
tion once my_coroutine yield or a special coroutine that runs the scheduler=
to pick up the next (this is immaterial for the example). On the call to s=
cheduler.yield_with, the my_coroutine, which is currently running, is suspe=
nded, the scheduler coroutine is activated and then the lambda callaback is=
invoked from inside 'scheduler'. Inside the lambda 'self' =
refers to the 'my_coroutine' that was just suspended.</div></blockq=
uote><div><br></div><div>Oh, I think I started to get the idea. The flow is=
basically:</div><div>1. Register the continuation</div><div>2. Suspend the=
coroutine</div><div>3. Call the continuation that starts the async op</div=
><div><br></div><div>Right?</div><div><br></div><div>My claim was based on =
the naive use of yield (e.g. the pattern that asio+boost.coroutine exposes)=
..</div><div>I'll remove the reasoning about the inability of yield, whi=
ch is due to my lack of imagination.</div></div><br></div><div class=3D"gma=
il_extra">Thanks for the explanation.</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--089e0111b5e220663105206c3c1e--
.
Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Wed, 23 Sep 2015 14:31:16 -0700 (PDT)
Raw View
------=_Part_889_1584970271.1443043876502
Content-Type: multipart/alternative;
boundary="----=_Part_890_1553367237.1443043876502"
------=_Part_890_1553367237.1443043876502
Content-Type: text/plain; charset=UTF-8
On Wednesday, September 23, 2015 at 5:02:03 PM UTC+1, TONGARI J wrote:
>
> 2015-09-23 22:31 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com
> <javascript:>>:
>
>> On Wednesday, September 23, 2015 at 3:19:21 PM UTC+1, TONGARI J wrote:
>>>
>>>
>>>
>>> 2015-09-23 17:43 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com>:
>>>
>>>> On Wednesday, September 23, 2015 at 3:49:38 AM UTC+1, TONGARI J wrote:
>>>>>
>>>>> 2015-09-23 6:01 GMT+08:00 Giovanni Piero Deretta <gpde...@gmail.com>:
>>>>>>
>>>>>> (this is not necessarily boost coroutine syntax, but should be close
>>>>>> enough)
>>>>>
>>>>> [snip]
>>>>>
>>>>>
>>>>> What's done in coroutine?
>>>>>
>>>>
>>>> What do you mean with this? Boost.Coroutine itself doesn't do the
>>>> callback passing by itself, but as shown above it can be easily implemented
>>>> on top of it. Of course an implementation built in the coroutine library
>>>> can be more performant. as you wouldn't pay for the feature unless you
>>>> explicitly need it.
>>>>
>>>
>>> With Boost.Coroutine, we'll pass a function for it to execute on
>>> construction, but I don't see anything like that in your code, not even an
>>> assignment to the coroutine base.
>>>
>>
>> The task wrapper imports the coroutine constructor via 'using', so all
>> the constructors (and operator=) have all the same semantics as for
>> boost.coroutine.
>>
>>
>>>
>>>
>>>> What's the relation between the callback you pass in and the one it
>>>>> returns?
>>>>>
>>>>
>>>> coroutine L passes to coroutine R the callback C_l it want to be
>>>> executed and, symmetrically, it executes the callback C_r it got from
>>>> coroutine R.
>>>>
>>>> C_l is executed on R context and get passed L as a parameter and
>>>> vice-versa.
>>>>
>>>
>>> Are you saying that you're spawing 2 coroutines for that? I only see
>>> one, the one you pass to `my_coroutine(task& scheduler)`. What am I missing?
>>>
>>
>> the my_coroutine function is of course running inside a coroutine (let's
>> call it, improperly, my_coroutine). 'scheduler' is another coroutine,
>> either the next in line in execution once my_coroutine yield or a special
>> coroutine that runs the scheduler to pick up the next (this is immaterial
>> for the example). On the call to scheduler.yield_with, the my_coroutine,
>> which is currently running, is suspended, the scheduler coroutine is
>> activated and then the lambda callaback is invoked from inside 'scheduler'.
>> Inside the lambda 'self' refers to the 'my_coroutine' that was just
>> suspended.
>>
>
> Oh, I think I started to get the idea. The flow is basically:
> 1. Register the continuation
> 2. Suspend the coroutine
> 3. Call the continuation that starts the async op
>
> Right?
>
yes, that's pretty much it.
-- gpd
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_890_1553367237.1443043876502
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Wednesday, September 23, 2015 at 5:02:03 PM UTC+1, TONGARI J wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div class=3D=
"gmail_quote">2015-09-23 22:31 GMT+08:00 Giovanni Piero Deretta <span dir=
=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailt=
o=3D"Nkj0xXBiBgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascr=
ipt:';return true;" onclick=3D"this.href=3D'javascript:';return=
true;">gpde...@gmail.com</a>></span>:<br><blockquote class=3D"gmail_quo=
te" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-col=
or:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On Wednesday,=
September 23, 2015 at 3:19:21 PM UTC+1, TONGARI J wrote:<span><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1=
px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:=
1ex"><div dir=3D"ltr"><br><div><br><div class=3D"gmail_quote">2015-09-23 17=
:43 GMT+08:00 Giovanni Piero Deretta <span dir=3D"ltr"><<a rel=3D"nofoll=
ow">gpde...@gmail.com</a>></span>:<br><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:r=
gb(204,204,204);border-left-style:solid;padding-left:1ex">On Wednesday, Sep=
tember 23, 2015 at 3:49:38 AM UTC+1, TONGARI J wrote:<span><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;b=
order-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"=
><div dir=3D"ltr"><div><div class=3D"gmail_quote">2015-09-23 6:01 GMT+08:00=
Giovanni Piero Deretta <span dir=3D"ltr"><<a rel=3D"nofollow">gpde...@g=
mail.com</a>></span>:<blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);b=
order-left-style:solid;padding-left:1ex">(this is not necessarily boost cor=
outine syntax, but should be close enough)</blockquote></div></div></div></=
blockquote></span>[snip]<span><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,=
204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"><div><div c=
lass=3D"gmail_quote"><div><br></div><div>What's done in coroutine?=C2=
=A0</div></div></div></div></blockquote></span><div><br>What do you mean wi=
th this? Boost.Coroutine itself doesn't do the callback passing by itse=
lf, but as shown above it can be easily implemented on top of it. Of course=
an implementation built in the coroutine library can be more performant. =
as you wouldn't pay for the feature unless you explicitly need it.<br><=
/div></blockquote><div><br></div><div>With Boost.Coroutine, we'll pass =
a function for it to execute on construction, but I don't see anything =
like that in your code, not even an assignment to the coroutine base.</div>=
</div></div></div></blockquote></span><div><br>The task wrapper imports the=
coroutine constructor via 'using', so all the constructors (and op=
erator=3D) have all the same semantics as for boost.coroutine.<br>=C2=A0</d=
iv><span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-styl=
e:solid;padding-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote">=
<div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-l=
eft-style:solid;padding-left:1ex"><div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb=
(204,204,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"><d=
iv><div class=3D"gmail_quote"><div></div><div>What's the relation betwe=
en the callback you pass in and the one it returns?</div></div></div></div>=
</blockquote><br>coroutine L passes to coroutine R the callback C_l it want=
to be executed and, symmetrically, it executes the callback C_r it got fro=
m=C2=A0 coroutine R.<br><br>C_l is executed on R context and get passed L a=
s a parameter and vice-versa.</div></blockquote><div><br></div><div>Are you=
saying that you're spawing 2 coroutines for that? I only see one, the =
one you pass to `my_coroutine(task& scheduler)`. What am I missing?</di=
v></div></div></div></blockquote></span><div><br>the my_coroutine function =
is of course running inside a coroutine (let's call it, improperly, my_=
coroutine). 'scheduler' is another coroutine, either the next in li=
ne in execution once my_coroutine yield or a special coroutine that runs th=
e scheduler to pick up the next (this is immaterial for the example). On th=
e call to scheduler.yield_with, the my_coroutine, which is currently runnin=
g, is suspended, the scheduler coroutine is activated and then the lambda c=
allaback is invoked from inside 'scheduler'. Inside the lambda '=
;self' refers to the 'my_coroutine' that was just suspended.</d=
iv></blockquote><div><br></div><div>Oh, I think I started to get the idea. =
The flow is basically:</div><div>1. Register the continuation</div><div>2. =
Suspend the coroutine</div><div>3. Call the continuation that starts the as=
ync op</div><div><br></div><div>Right?</div></div></div></div></blockquote>=
<div><br>yes, that's pretty much it.</div><br>-- gpd<br>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_890_1553367237.1443043876502--
------=_Part_889_1584970271.1443043876502--
.