[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: yield from __close
- From: 云风 Cloud Wu <cloudwu@...>
- Date: Tue, 14 Jun 2022 16:12:11 +0800
John Belmonte <firstname.lastname@example.org> 于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.
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