diff -r 0238cc842805 Lib/sched.py --- a/Lib/sched.py Thu Dec 06 17:49:58 2012 -0500 +++ b/Lib/sched.py Sat Dec 08 11:26:59 2012 +0200 @@ -67,10 +67,10 @@ if necessary. """ + event = Event(time, priority, action, argument, kwargs) with self._lock: - event = Event(time, priority, action, argument, kwargs) heapq.heappush(self._queue, event) - return event # The ID + return event # The ID def enter(self, delay, priority, action, argument=[], kwargs={}): """A variant that specifies the time as a relative time. @@ -78,9 +78,8 @@ This is actually the more commonly used interface. """ - with self._lock: - time = self.timefunc() + delay - return self.enterabs(time, priority, action, argument, kwargs) + time = self.timefunc() + delay + return self.enterabs(time, priority, action, argument, kwargs) def cancel(self, event): """Remove an event from the queue. @@ -159,4 +158,4 @@ # the actual order they would be retrieved. with self._lock: events = self._queue[:] - return map(heapq.heappop, [events]*len(events)) + return map(heapq.heappop, [events]*len(events))