Message407836
Good point.
Currently, asyncio lock objects don't provide a strong FIFO guarantee.
In a tight loop, a task can re-acquire the lock just after releasing even if there are pending waiters that were scheduled earlier. It's true also for Lock, Conditional, Event, etc.
The solution requires *async* release method. Since the change is not backward compatible, a new method should be added, e.g. `await sem.release_and_wait()` for endorsing the context switch if there are pending waiters.
async context manager can be modified for using the new method without backward compatibility problems easily.
A hero who can help is welcome! |
|
Date |
User |
Action |
Args |
2021-12-06 16:43:29 | asvetlov | set | recipients:
+ asvetlov, yselivanov, hyzyla |
2021-12-06 16:43:29 | asvetlov | set | messageid: <1638809009.26.0.994587911759.issue45997@roundup.psfhosted.org> |
2021-12-06 16:43:29 | asvetlov | link | issue45997 messages |
2021-12-06 16:43:29 | asvetlov | create | |
|