[issue44681] time.sleep(0.001) not working properly

Eryk Sun report at bugs.python.org
Wed Jul 28 03:19:50 EDT 2021


Eryk Sun <eryksun at gmail.com> added the comment:

> It certainly wouldn't be worth the power and CPU usage 
> impact that people would inevitable get tricked into 
> causing

To clarify, only short waits such as time.sleep(0.001) would busy loop. Waits longer than say 50 ms would call WaitForSingleObjectEx() or Sleep() with the wait time minus 50, and then busy loop until the deadline. So  time.sleep(1) would wait the thread for 95% of the interval.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44681>
_______________________________________


More information about the Python-bugs-list mailing list