better scheduler with correct sleep times

greg greg at cosc.canterbury.ac.nz
Mon Oct 20 20:19:49 EDT 2008


sokol wrote:

> What was a surprise to me was that python sched.py makes the same
> mistake as I did in my first version.

The sched module is *not* designed for multithreading. It
assumes that the thread waiting for events is the only one
putting events into the queue, so it's impossible for an
event to get scheduled while in the midst of a sleep. It
also doesn't take any measures to protect its data structures
from concurrent access.

The documentation could make this clearer, especially since
it confusingly talks about "allowing other threads to run".

-- 
Greg



More information about the Python-list mailing list