标签:with loop imp cio name let print __name__ event
await 不会沿用锁,要非常谨慎
import asyncio lock = asyncio.Lock() async def a(): async with lock: await b() async def b(): async with lock: print(1) if __name__ == ‘__main__‘: loop = asyncio.get_event_loop() loop.run_until_complete(a())
死锁!!
标签:with loop imp cio name let print __name__ event
原文地址:https://www.cnblogs.com/inshua/p/8961815.html