[issue45997] asyncio.Semaphore waiters deqeueu doesn't work

2021-12-06 Thread Andrew Svetlov
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

[issue45997] asyncio.Semaphore waiters deqeueu doesn't work

2021-12-06 Thread Yevhenii Hyzyla
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