lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On 2 Oct 2022, at 15:27, John Belmonte <john@neggie.net> wrote:

I've posted part 3, which fleshes out nursery cancellation:



I’ve followed the discussions here and find it really interesting. A major drawback is the missing ability of Lua to run “nested” coroutines without getting into nasty problems.

For example; if you run this on top of Copas, and a Trio task would call a Copas socket function (read/write/connect) it would do a Copas yield to the Trio scheduler (meaning it would pass the Copas socket and request (read/write) to Trio, which would not be expecting those.

Even if you use the tagged coroutines [1] it would probably mean that a single Trio task calling a read/write op, would mean the entire Trio scheduler would get paused.

So do you think it would be possible to implement this on top of an existing scheduler? What primitive functions would be required to make it work? In an abstract interface with things like;
- runtask(func)
- sleep(seconds)
- sleep_forever()
- wakeup(coro)
- canceltask(coro)


Thijs

[1] see https://github.com/mascarenhas/taggedcoro and https://github.com/saucisson/lua-coronest