File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ def __init__(
152
152
self ._name = name
153
153
self ._skip_sleep = False
154
154
self ._thread_will_exit = False
155
- self ._lock = _ALock ( _create_lock () )
155
+ self ._lock = _create_lock ()
156
156
157
157
def __repr__ (self ) -> str :
158
158
return f"<{ self .__class__ .__name__ } (name={ self ._name } ) object at 0x{ id (self ):x} >"
@@ -224,21 +224,21 @@ def update_interval(self, new_interval: int) -> None:
224
224
def skip_sleep (self ) -> None :
225
225
self ._skip_sleep = True
226
226
227
- async def _should_stop (self ) -> bool :
228
- async with self ._lock :
227
+ def _should_stop (self ) -> bool :
228
+ with self ._lock :
229
229
if self ._stopped :
230
230
self ._thread_will_exit = True
231
231
return True
232
232
return False
233
233
234
- async def _run (self ) -> None :
235
- while not await self ._should_stop ():
234
+ def _run (self ) -> None :
235
+ while not self ._should_stop ():
236
236
try :
237
- if not await self ._target ():
237
+ if not self ._target ():
238
238
self ._stopped = True
239
239
break
240
240
except BaseException :
241
- async with self ._lock :
241
+ with self ._lock :
242
242
self ._stopped = True
243
243
self ._thread_will_exit = True
244
244
@@ -249,7 +249,7 @@ async def _run(self) -> None:
249
249
else :
250
250
deadline = time .monotonic () + self ._interval
251
251
while not self ._stopped and time .monotonic () < deadline :
252
- await asyncio .sleep (self ._min_interval )
252
+ time .sleep (self ._min_interval )
253
253
if self ._event :
254
254
break # Early wake.
255
255
You can’t perform that action at this time.
0 commit comments