[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tail calling many resumes
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 23 Mar 2021 13:00:52 -0300
> Hello, I need a way to resume a coroutine in a way that does not blow out
> my stack in a tail call chain of many calls. Right now when i "return
> resume(..)" I consume the stack pretty quickly. Would it even be possible
> to do some sort of "tail resume"?
The standard way to handle that kind of scenario is to have some
dispatcher calling the coroutines in a loop. When one coroutine
wants to transfer control to another, it yields with some specific
value that instructs the dispatcher to resume that other coroutine.
-- Roberto