In decorators.interruptible_sleep, use event.wait instead of polling every second
See original GitHub issueIt uses less CPU time. See event.wait
here.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Python time.sleep() vs event.wait() - Stack Overflow
I use Event.wait in this situation even though python 2.x is polling in the background. Sleeping at, say, 1 second intervals is reasonably ......
Read more >Polling by sleeping versus polling by waiting with a timeout
The second one will use 2. But is the first scenario wasting more thread time? Is it worth using the event (kernel object)?”....
Read more >Are the states of processes which are ready and scheduled to ...
A process that is waiting to be scheduled isn't idle: the reason it ... S interruptible sleep (waiting for an event to complete)...
Read more >comp.programming.threads FAQ - Dan Luu
If I use a SPARC 10, the program only takes 1 second to terminate. Is SPARC 2000 slower than a SPARC 10? 2....
Read more >Linux.System.Programming by Andy L - Issuu
In the rare event of a system call with more than five parameters, a single ... Instead, Linux aims toward compliance with two...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was using the terms interchangeably, but yes, you could say that. Also, sleeping this way does free up the GIL, which would be important if multi-threading of any kind was ever added.
You got it. Love this project, by the way. Super convenient.
@hugovk Ah, forgot about the GIL. So you’re telling me that when running in Python 2 there wouldn’t be as much a difference (since the sleeping is done in Python), but in Python 3 there would be?