ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Threading is actually fair
by Matt Kimball other posts by this author
May 21 2002 3:06PM messages near this date
Re: Q: going from tuple to comma-separated list? | Re: Threading unfairness
Okay, Tim was right, of course.  Python's global interpreter lock wasn't the
cause of any of my complaints about threading unfairness.  

For those interested, part of the problem was that my background computation
thread was flooding my GUI with "update" events, telling my main GUI thread that
it had new data and wanted to repaint its views of said data.  I throttled that
back so that it doesn't send an update more frequently than every 100 ms and it
helped a bit.

The second half of the solution was actually to set the thread priority of my
background computation to something lower than the GUI thread.  This made the
GUI responsiveness much, much better.  Using win32all, in my background
computation thread, I do this before any of the real work:

win32process.SetThreadPriority(win32api.GetCurrentThread(), 
                               win32process.THREAD_PRIORITY_BELOW_NORMAL)

And from there on out, things run very smoothly.

-- 
Matt Kimball
matt@[...].net




-- 
http://mail.python.org/mailman/listinfo/python-list

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved