lua-users home
lua-l archive

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


John Belmonte <john@neggie.net> 于2022年4月30日周六 08:56写道:
>
> Please keep "yield from __close" in mind for the next version of Lua.
>
> In Python there have been efforts to make limited asyncio support available for tiny environments (MicroPython, etc.).  However, supporting the structured concurrency libraries on top of that doesn't appear feasible due to the heavy dependencies.
>
> With this feature, Lua could have async context managers (blocking for I/O on scope exit) and support structured concurrency.  Moreover, this would run on microcontrollers and embedded applications without effort.  Having high-level concurrency constructs from a scripting language in such environments would set a new precedent.
>

+1 .

We need "yield from __close" in skynet ( https://github.com/cloudwu/skynet )

In skynet, socket.close() will yield current thread until it recvs the
socket close message, and then the scheduler could resume the thread.
If we call socket.close() in __close, the current thread may not
yield.