Thanks for a couple of very useful comments.
The usefulness of wait_for(), especially in avoiding the problem of spurious-waits, is something I'd forgotten - this is really just syntactic sugar, but I agree it is very useful - as illustrated by the fact that I didn't remember to put my wait() call in its own loop in my example!
On the other hand, the lack of locking makes this new thing more like an Event than a Condition. Also, since it would only make sense for one thread to wait on this object, rather than many, that again makes it more like an Event. And Event only has wait(), not wait_for() - it makes no sense to "loop" on an object that is "sticky", you would just get livelock. So in summary, this new class (or behaviour) would still only have wait() and not wait_for(). Does that devalue it, do you think?
I know that C# has AutoResetEvent, but I didn't know it was native to the Windows API. I'm pretty sure it is not native to Linux (there are a couple of other useful features, such as "Wait on multiple events", that are in Windows but not Linux, and therefore are also not in Python). Does this affect implementation - would you expect an AutoResetEvent to be implemented natively on Windows, rather than being composed out of pure Python using a boolean and a Condition?
Regarding the link you sent, I don't entirely agree with the opinion expressed: if you try to use a Semaphore for this purpose you will soon find that it is "the wrong way round", it is intended to protect resources from multiple accesses, not to synchronize those multiple accesses.
-----Original Message----- From: email@example.com Sent: Tuesday, March 26, 2019 10:49 AM To: firstname.lastname@example.org Subject: Python-ideas Digest, Vol 148, Issue 143
Send Python-ideas mailing list submissions to email@example.com
To subscribe or unsubscribe via the World Wide Web, visit https://mail.python.org/mailman/listinfo/python-ideas or, via email, send a message with subject or body 'help' to firstname.lastname@example.org
You can reach the person managing the list at email@example.com
When replying, please edit your Subject line so it is more specific than "Re: Contents of Python-ideas digest..."
1. The Mailing List Digest Project (Abdur-Rahmaan Janhangeer) 2. Simpler thread synchronization using "Sticky Condition" (Richard Whitehead) 3. Re: Simpler thread synchronization using "Sticky Condition" (Antoine Pitrou) 4. Re: A directive for indentation type, stricter indentation parsing. (Mikhail V)
Message: 1 Date: Tue, 26 Mar 2019 09:07:15 +0400 From: Abdur-Rahmaan Janhangeer firstname.lastname@example.org To: Python email@example.com, python-ideas firstname.lastname@example.org Subject: [Python-ideas] The Mailing List Digest Project Message-ID: CADrxXXmP3-1eyYPNRgaQb1MOcXA8yYVHxxDk6orX85gExR4wRg@mail.gmail.com Content-Type: text/plain; charset="utf-8"
As proposed on python-ideas, i setup a repo to turn mail threads into articles.
here is the repo
i included a script to build .md to .html (with syntax highlighting) here is the index
included 3 articles as a start
if you want to contribute an article, just follow existing .md format and put it in the .md folder
planning to go across ideas, list and dev
i can tell you, it's a really enjoyable experience.
psst. we can enhance some html later