Unpreempted behavior with sys.setcheckinterval

Aahz aahz at pythoncraft.com
Fri Apr 17 09:23:49 EDT 2009


In article <c982207b-388d-4608-a1c1-7a1a84293d27 at u8g2000yqn.googlegroups.com>,
k3xji  <sumerc at gmail.com> wrote:
>
>I want unpreempted behavior for some application and do some testing
>as below. Well the unpreemption behavior is working fine with
>sys.setcheckinterval(sys.maxint). However, when I set the interval to
>a lower value, the thread does not being preempted anymore, it runs
>until it is finished. 

I'm sorry, I think English is not your primary language, and I can't
quite understand what you mean here.  Please rephrase.

Note that sys.setcheckinterval() is *not* designed to force threads to
run to completion, only to allow you to change the time chunk for a
thread to process, and if anything goes through the GIL, the thread may
yield.  To force a thread to be the only thread running, you need to use
some kind of locking.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list