This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author asvetlov
Recipients asvetlov, hyzyla, yselivanov
Date 2021-12-06.16:43:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638809009.26.0.994587911759.issue45997@roundup.psfhosted.org>
In-reply-to
Content
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!
History
Date User Action Args
2021-12-06 16:43:29asvetlovsetrecipients: + asvetlov, yselivanov, hyzyla
2021-12-06 16:43:29asvetlovsetmessageid: <1638809009.26.0.994587911759.issue45997@roundup.psfhosted.org>
2021-12-06 16:43:29asvetlovlinkissue45997 messages
2021-12-06 16:43:29asvetlovcreate