You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
Since asyncio.Lock is not reentrant, there is no way the same task could acquire the same lock more than once, so the following code will obviously block:
importasynciomutex=asyncio.Lock()
asyncdefchild_coro():
asyncwithmutex:
print('Hello from chile_coro')
asyncdefparent_coro():
asyncwithmutex: # the code will block hereprint('Hello from parent_coro')
awaitchild_coro()
asyncio.get_event_loop().run_until_complete(parent_coro())
Is there any viable reason to implement an asyncio.RLock, similar to a threading.RLock?