[Python-Dev] Replacing threads with swapcontext()

Alexander Sabourenkov screwdriver at lxnt.info
Wed Mar 31 17:23:27 CEST 2010


I have went and replaced Python threads with explicitly-scheduled 
coroutines using swapcontext() family of functions (basically out of 
frustration with the greenlet).

I have two questions.

1. Is it as dangerous to switch C stacks and not switch PyThreadState as 
I suspect? In particular, how tightly is PyThreadState::frame coupled to 
current C stack?

2. How do you all look at merging my work as another threading-related 
configure switch? It's only another thread_something.h file and a small 
patch to threadmodule.c.

Project is at http://code.google.com/p/coev/



More information about the Python-Dev mailing list