Spawning a thread and printing dots until it finishes

D'Arcy J.M. Cain darcy at druid.net
Tue Apr 22 17:18:42 EDT 2008


On Tue, 22 Apr 2008 13:45:32 -0700
Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Tue, 22 Apr 2008 13:25:07 -0400, "D'Arcy J.M. Cain" <darcy at druid.net>
> declaimed the following in comp.lang.python:
> 
> 
> > I think that there are two things that you need to wrap your head
> > around before understanding what is happening here.  First, threads are
> > NOT pre-emptive.  Unless your thread gives up the processor it will run
> > forever.  The sleep call is one way to give up the processor.
> >
> 	When did that change take place?
> 
> 	As I recall, the Python interpreter is supposed to preempt a (pure
> Python) thread after some 10 or 100 (I think the value changed some
> years ago) bytecodes.

It sounds to me like you are talking about when the interpreter grabs
and releases the GIL but I was talking about when it releases the
processor.  I certainly never said that sleep() was the only way to
release the processor.  I was not actually aware that running a certain
number of bytecodes was another way but as I said, we never saw the
code for the thread so we don't know what it is doing or what
extensions it might be calling.  It *may* be pure Python but we don't
know.

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list