Threading unfairness

Cliff Wells logiplexsoftware at earthlink.net
Thu May 23 13:23:54 EDT 2002


On Sat, 18 May 2002 13:54:36 -0700 (PDT)
Matt Kimball wrote:

> While writing some multithreaded GUI code with ActivePython 2.2.1 under
Windows
> XP, on a single processor machine, and I noticed that my user-interface
thread
> was very unresponsive when I had a background computation thread going.  This
> annoyed me.  It seemed like the main thread where the GUI code was running
was
> being starved of CPU time.  Since there doesn't seem to be any way to set
thread
> priorities with Python, I "fixed" the problem with inserting frequent
> 'time.sleep(0)' calls in my compute-intensive thread, and that seemed to give
my
> main GUI thread more time to execute when a user-interface event occurred.  

I wonder if sys.setcheckinterval() would help.  I've seen it in the docs but
haven't tested it myself.

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308





More information about the Python-list mailing list