Issue #16640: Run less code under a lock in sched module.
This commit is contained in:
parent
1147f82438
commit
d07db96ab6
|
@ -71,8 +71,8 @@ class scheduler:
|
|||
"""
|
||||
if kwargs is _sentinel:
|
||||
kwargs = {}
|
||||
with self._lock:
|
||||
event = Event(time, priority, action, argument, kwargs)
|
||||
with self._lock:
|
||||
heapq.heappush(self._queue, event)
|
||||
return event # The ID
|
||||
|
||||
|
@ -82,7 +82,6 @@ class scheduler:
|
|||
This is actually the more commonly used interface.
|
||||
|
||||
"""
|
||||
with self._lock:
|
||||
time = self.timefunc() + delay
|
||||
return self.enterabs(time, priority, action, argument, kwargs)
|
||||
|
||||
|
|
Loading…
Reference in New Issue