[Python-ideas] Simpler thread synchronization using "Sticky Condition"
solipsis at pitrou.net
Tue Mar 26 06:38:14 EDT 2019
On Tue, 26 Mar 2019 09:27:18 -0000
"Richard Whitehead" <richard.whitehead at ieee.org>
> Using Python's Condition class is error-prone and difficult. For example,
> the following pseudo-code would be quite typical of its use:
Nowadays, I would recommend to always use `Condition.wait_for()` rather
A Condition, unlike what the name suggests, is just a means of
synchronization. It doesn't have a boolean state per se. You have to
manage your boolean state (or any other kind of state) separately, hence
the usefulness of `wait_for()`.
As for auto-reset events, the Windows API has them, here's an
insightful writeup about them:
But, yes, perhaps auto-reset events would be a good addition
regardless. Either through a flag to Event, or as a separate class.
More information about the Python-ideas