Andrew Svetlov added the comment:
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
New submission from Yevhenii Hyzyla :
Class `asyncio.Semaphore` has dequeue in implementation for waiters of
semaphore and seems like the intention of this dequeue is to maintain FIFO
queue of waiters. But it doesn't work, coroutine that releases semaphore can
acquire semaphore again. Below i