Stackless, thread paradigm and C extensions

Frederic Giacometti frederic.giacometti at arakne.com
Wed Nov 14 16:22:26 CET 2001


> But while it requires OS thread support, it collides with support of
> OS threads, doesn't it?  For example, the threaded applications I write
> use one thread per window, threads created by Window.Show().  Those
> threads call back into the interpreter on window events, and the
> interpreted code calls right back into the C level graphics library;
> that library is built around this multi-threaded system and the calling
> thread isn't something to select arbitrarily from a pool, it has to be
> the thread that supports the Window object that noticed the event.

The continuation in the Python interpreter has to keep a pointer to the C
thread to which it is to return.
Here, we would be in the case of non-rentrant threads (thread with a state
memory, as opposed to stateless thread, to use the analogy with server
processes/threads). The sending C thread would not be assigned another
thread/continuation of control, and would remain idle. Thus, it could
execute the callbacks from its Python continuation.

FG







More information about the Python-list mailing list