[Python-Dev] Re: [Stackless] comments on PEP 219

Christian Tismer tismer@tismer.com
Thu, 15 Mar 2001 13:41:07 +0100


Greg Ewing wrote:
> 
> Christian Tismer <tismer@tismer.com>:
> 
> > You can *create* a thread using a callback.
> 
> Okay, that's not so bad. (An earlier message seemed to
> be saying that you couldn't even do that.)
> 
> But what about GUIs such as Tkinter which have a
> main loop in C that keeps control for the life of
> the program? You'll never get back to the base-level
> interpreter, not even between callbacks, so how do
> the uthreads get scheduled?

This would not work. One simple thing I could think of is
to let the GUI live in an OS thread, and have another
thread for all the microthreads.
More difficult but maybe better: A C main loop which
doesn't run an interpreter will block otherwise. But
most probably, it will run interpreters from time to time.
These can be told to take the scheduling role on.
It does not matter on which interpreter level we are,
we just can't switch to frames of other levels. But
even leaving a frame chain, and re-entering later
with a different stack level is no problem.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net/
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com/