Second Draft: Coroutines
Sebastiaan Koppe
mail at skoppe.eu
Thu Jan 23 21:17:08 UTC 2025
On Thursday, 23 January 2025 at 20:37:59 UTC, Richard (Rikki)
Andrew Cattermole wrote:
>
> On 24/01/2025 9:12 AM, Sebastiaan Koppe wrote:
>> Upon yielding a coroutine, say a socket read, you'll want to
>> park the coroutine until the socket read has completed. This
>> requires a signal on completion of the async operation to the
>> execution context to resume the coroutine.
>
> Right, I handle this as part of my scheduler and worker pool.
>
> The language has no knowledge, nor need to know any of this
> which is why it is not in the DIP.
Without having a notion on how this might work I can't reasonably
comment on this DIP.
> How scheduling works, can only lead to confusion if it is
> described in a language only proposal (I've had Walter attach
> on to such descriptions in the past and was not helpful).
You don't need to describe how scheduling works, just the
mechanism by which a scheduler gets notified when a coroutine is
ready for resumption.
Rust has a Waker, C++ has the await_suspend function, etc.
More information about the dip.development
mailing list