[Stackless] Question about reactor.interleave and callFromReactor

Andrew Francis andrewfr_ice at yahoo.com
Sun Jan 21 02:46:55 CET 2007

Hello Colleagues :

I understand that there aren't many people that use
both Stackless and Twisted. However there seems to be
people working on the same thing and we all seem to
have pieces of a solution. I am still unclear about
writing a reactor for Stackless.  I am running on the
assumption that it is best to run Stackless and
Twisted in their own threads (if I could do what I
want in a single thread, that would be great). I am
also operating under the assumption that it good to
have the two threads communicate via queues

These are some of the issues I don't understand :

1. Whether (and how) one should call a deferred using
callFromThread? For instance

1A. What does callFromThread exactly do? Will the
calling thread block?

2. How does reactor.interleave work? Assume that the
main Stackless loop is as follows :

#set stuff up

while (stackless.getruncount() > 1) :

and my callbacks and request handlers write to a
queue. Example :


def __handleResponse__(self, pageData):


def processResponse(self, httpServer):
           get reply
           reply = self.myQueue.get()

What should I do to make the Stackless and Twisted
threads to properly inter-operate? Besides a client
time-out from a slow RequestHandler, that are the
pit-falls of a requestHandler blocking on a reply from
a queue?

Once I have a solution, I would be more than happy to 
summarize on the Stackless wiki. Thanks in advance.


Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list