graywolf on Nostr: I am thinking about how to do a co-operative multi-tasking in Guile, or rather how to ...
I am thinking about how to do a co-operative multi-tasking in Guile, or rather how to suspend execution for later. I will write the "scheduler" loop and the procedure that needs to suspended. Between the scheduler loop and the procedure, there can be any not-my code (but scheme only, so continuations will work). (And before someone suggests "just use fibers", the suspending will not be done only due to IO reasons.)
Since I am new to this, I am quite unsure what primitive use for this.
reset/shift does not seem to be a good fit.
Prompts, maybe? The scheduler could use call-with-prompt and return the continuation from handler. The procedure would abort-to-prompt. Then the scheduler can use the continuation to continue later.
There also is call/cc.
Anything else?
Would anyone have an opinion or advice on this? Or maybe links to code doing something similar?
#guile #scheme
Since I am new to this, I am quite unsure what primitive use for this.
reset/shift does not seem to be a good fit.
Prompts, maybe? The scheduler could use call-with-prompt and return the continuation from handler. The procedure would abort-to-prompt. Then the scheduler can use the continuation to continue later.
There also is call/cc.
Anything else?
Would anyone have an opinion or advice on this? Or maybe links to code doing something similar?
#guile #scheme