[pypy-dev] Extension Modules Re: Question on Hard Switching and Soft Switching

Donovan Preston dsposx at mac.com
Sun Oct 4 22:17:31 CEST 2009


On Oct 4, 2009, at 4:42 AM, Armin Rigo wrote:

<snip>

> I fear that we don't want to spend much time improving
> Stackless support right now, but you are welcome to try and contribute
> e.g. a modification to the '_select' module to optionally use,
> internally, non-blocking sockets and be Stackless-aware in a
> user-transparent manner.  (Such a module can even be written in plain
> Python and be portable across Stackless Python and Stackless PyPy.  It
> might even already have been written for Stackless Python; you should
> look around.)

Eventlet implements the blocking socket apis, using non-blocking i/o  
under the hood in a user-transparent manner, by using the greenlet  
apis. Eventlet already works on stackless pypy. Eventlet in theory  
also works on stackless python but I don't know how many people have  
actually tried it.

Eventlet also provides monkeypatching of the socket module so existing  
code doesn't have to change. Eventlet even provides implementations of  
the thread and threading modules so that code which is written to use  
preemptive threads can transparently be used with green threads.

There are also several other implementations of cooperative sockets  
specific for Stackless Python. I think one even comes distributed with  
the source.

Donovan





More information about the Pypy-dev mailing list