diff options
author | Georg Brandl <georg@python.org> | 2007-10-08 08:06:05 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-10-08 08:06:05 (GMT) |
commit | a970c2216645a86b532f68bfb93b8ec9da858b0d (patch) | |
tree | b9267f44a4a5fe4dae989b9e88efe1241d39baa7 /Lib/sched.py | |
parent | 16fd6c46174d105e34d84befb67429165d0c6c18 (diff) | |
download | cpython-a970c2216645a86b532f68bfb93b8ec9da858b0d.zip cpython-a970c2216645a86b532f68bfb93b8ec9da858b0d.tar.gz cpython-a970c2216645a86b532f68bfb93b8ec9da858b0d.tar.bz2 |
Update docstring of sched, also remove an unused assignment.
Diffstat (limited to 'Lib/sched.py')
-rw-r--r-- | Lib/sched.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/sched.py b/Lib/sched.py index 7c3235e..51c4e74 100644 --- a/Lib/sched.py +++ b/Lib/sched.py @@ -16,11 +16,11 @@ integers or floating point numbers, as long as it is consistent. Events are specified by tuples (time, priority, action, argument). As in UNIX, lower priority numbers mean higher priority; in this way the queue can be maintained as a priority queue. Execution of the -event means calling the action function, passing it the argument. -Remember that in Python, multiple function arguments can be packed -in a tuple. The action function may be an instance method so it +event means calling the action function, passing it the argument +sequence in "argument" (remember that in Python, multiple function +arguments are be packed in a sequence). +The action function may be an instance method so it has another way to reference private data (besides global variables). -Parameterless functions or methods cannot be used, however. """ # XXX The timefunc and delayfunc should have been defined as methods @@ -89,7 +89,7 @@ class scheduler: exceptions are not caught but the scheduler's state remains well-defined so run() may be called again. - A questionably hack is added to allow other threads to run: + A questionable hack is added to allow other threads to run: just after an event is executed, a delay of 0 is executed, to avoid monopolizing the CPU when other threads are also runnable. @@ -111,7 +111,7 @@ class scheduler: # Verify that the event was not removed or altered # by another thread after we last looked at q[0]. if event is checked_event: - void = action(*argument) + action(*argument) delayfunc(0) # Let other threads run else: heapq.heappush(event) |