A Solution using Tasks Re: [Stackless] Suggestion for a Solution ? Re: Blocking Problem with Stackless Python and Twisted

Andrew Francis andrewfr_ice at yahoo.com
Wed Jun 28 14:05:14 EDT 2006


Hello Patrick:

--- "Patrick M. Nielsen" <thirsteh at gmail.com> wrote:

> I had a similar problem, and Radix's threadless
> Twisted snippet proved to be
> a very viable solution
> 
> Have a look at:
>
>http://twistedmatrix.com/trac/browser/sandbox/radix/threadless.py?rev=17407

Thanks for the advice. Bob Ippolito also suggested
this. However I have been experimenting with the
Twisted task class.

I am still testing but I have done the following with
success.

1. Set up a function -

def pump():
    stackless.schedule()

2. l = task.LoopingCall(pump)
   l.start(some_time_period)
   reactor.listenTCP(port, MyHttpFactory())
   reactor.run()

While Twisted waits for a connection, the call to
pump() allows other tasklets that are waiting, a
chance to run.

Once I know all the ins-and-outs, I will write this up
in the Wiki including an example.

Thanks for everyone's help.

Cheers,
Andrew


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Python-list mailing list