[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: yield from __close
- From: 云风 Cloud Wu <cloudwu@...>
- Date: Tue, 14 Jun 2022 16:23:16 +0800
云风 Cloud Wu <email@example.com> 于2022年6月14日周二 16:12写道：
> 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.
> +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
Lua 5.4.4 has already support "yield from __close". sorry for the noise.