Skip to content
Snippets Groups Projects
Commit c3a36212 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

refactor safe_sleep

parent 2e14358d
No related branches found
Tags v2.8.16
No related merge requests found
......@@ -134,9 +134,7 @@ class TerminableThread(threading.Thread):
:return: status of _terminating flag at the exit
"""
t = 0
while t < interval:
if self._terminating:
return True
while t < interval and not self._terminating:
remaining_to_sleep = min(interval-t, wake_up_each)
time.sleep(remaining_to_sleep)
t += remaining_to_sleep
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment