No subject


Sun Apr 26 08:47:01 EDT 2009


Unlike other network libraries and similar to eventlet, gevent starts
the event loop implicitly in a dedicated greenlet. There's no
``reactor`` that you must ``run()`` or ``dispatch()`` function to call.
When a function from gevent API wants to block, it obtains the
:class:`Hub` - a greenlet that runs the event loop - and switches to it.
If there's no :class:`Hub` instance yet, one is created on the fly.

Not sure if you can say that "coroutines are scheduled directly in the
main loop".


>> while with Twisted and Python applications
>> embedded in C servers like Nginx, you have to return control to the
>> "framework" (this what the x-wsgiorg.suspend WSGI extension does).
> 
> It looks like I misremembered the interface provided by txwsgi.  I 
> thought it let you switch to another coroutine directly, 

No, since this would not be possible with a WSGI implementation embedded
in Nginx.

You *need* to return control to the event loop (process cycle in Nginx).

> rather than 
> requiring that you yield an empty string after (the equivalent of) 
> setting a flag.  This seems to be more because of WSGI constraints than 
> anything else, though.
> 

Regards  Manlio



More information about the Twisted-Python mailing list