Pseudo threads (was Re: More Tkinter questions)

Guido.van.Rossum@cwi.nl
Wed, 08 Jun 1994 10:12:18 +0200

> > I would use a single process and call select to figure out if there's
> > anything to read from the socket. I don't know tk well enough (yet)
> > to know if it has hooks for this, but you can always use 'after' to
> > have some Python function called frequently (e.g. every 10 msec).
>
> Actually, I'd like this in some non-Tk cases. There probably should be
> a Python main loop module. I've been thinking that Python needs
> pseudo-threads for non-threaded OS's, and this might be the driver.

I've often thought about this, but there are lots of problems.
E.g. when one thread does a blocking read (say waiting for input from
a socket, as in Steve Miale's example), how do you guarantee progress
in the other thread? The problem is that the read is actually done in
some C code that's a black box for the interpreter.

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>