Discussion:
[std-discussion] Coroutine stack location and addresses
Itaj Sherman
2018-11-19 00:17:00 UTC
Permalink
Is it supposed to be legal for coroutine A, to take a reference to a local
variable (on it's own stack) and pass it to another coroutine or main
thread to access the object while coroutine A is not running?
Whether it passes the pointer through the coroutine return API or by
writing it in a static structure.

itaj
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
Victor Dyachenko
2018-11-19 09:23:42 UTC
Permalink
I suppose it's legal for stackful coroutines (Boost.Context,
Boost.Coroutine2) but illegal for stackless ones (co_await/Gog-routines)
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
Itaj Sherman
2018-11-19 11:32:14 UTC
Permalink
Post by Victor Dyachenko
I suppose it's legal for stackful coroutines (Boost.Context,
Boost.Coroutine2) but illegal for stackless ones (co_await/Gog-routines)
Maybe the intention is that if the compiler sees a reference to a local
object that is possibly passed outside the coroutine, it has to allocate
the object itself at a stable location, and only keep a pointer on its own
execution stack.
So it could be legal, and technically then, it doesn't have to be
mentioned, but I guess it should be for clarity.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
Loading...