[Stackless] Twisted and Stackless Re: An idea for making

Christopher Armstrong radix at twistedmatrix.com
Mon Sep 18 16:58:17 CEST 2006


On 9/14/06, Andrew Francis <andrewfr_ice at yahoo.com> wrote:
>
> Hi Christopher:
>
> >I have no idea how you got there. If you're using the
> >usual connect and listen methods, connectTCP and
> >listenTCP (and their siblings for UDP, SSL,
> >etc), they will certainly not block.
>
> To begin, here is Bob Ippolito's answer to my initial
> problem.
>
> >From: Bob Ippolito <bob at redivi.com>
> >Subject: Re: [Stackless] Blocking Problem with
> >Stackless Python and Twisted
>
> >Twisted isn't designed for Stackless integration, and
> >the approach you're taking simply will not work.
>
> >Twisted does block on reactor.run(), and during each
> >runloop  iteration it blocks waiting for a timeout or
> >network activity (via  select or poll usually).




> Looking at selectreactor, I see :
>
> win32select(r, w, e, timeout=None)
>
> I'll assume if timeout is None, select will block
> indefinitely until some activity occurs. And I don't
> see reactor.run() taking a parameter. So this
> corresponds with Bob's explanation and my
> observations. I haven't looked but I will assume
> LoopCall under the hood sets the timeout on the
> select.


It is true that reactor.run() blocks, but once you're inside the running
reactor, you can end up using stackless in such a way as to not even notice.
You could write a toolkit that looks entirely different from typical
Twisted-looking code using Stackless without changing Twisted at all. The
stackless/deferred integration module I wrote gets you most of the way
there, and further possibilities involve stuff like a synchronous-looking
protocol handling API.


-- 
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20060918/56e13876/attachment.htm>
-------------- next part --------------
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless


More information about the Stackless mailing list