Issue #16640: Run less code under a lock in sched module.

This commit is contained in:
Serhiy Storchaka 2012-12-29 21:46:37 +02:00
parent 1147f82438
commit d07db96ab6
2 changed files with 7 additions and 6 deletions

View File

@ -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)

View File

@ -200,6 +200,8 @@ Core and Builtins
Library
-------
- Issue #16640: Run less code under a lock in sched module.
- Issue #16165: Fix sched.scheduler.run() method was block a scheduler for
other threads.