[Stackless] stackless and system threads
andrewfr_ice at yahoo.com
Sat Feb 3 17:25:15 CET 2007
Hello Andrew :
> Message: 1
> Date: Fri, 2 Feb 2007 15:27:59 -0500
> From: Andrew Dalke <dalke at dalkescientific.com>
> Subject: [Stackless] stackless and system threads
> To: stackless at stackless.com
<115d0429d704274fcaec543a84a18f87 at dalkescientific.com>
> Content-Type: text/plain; charset=US-ASCII;
> I want to show how to have stackless work with
> system threads, as when dealing with functions which
>have no non-blocking solution.
I need to look at your code in more detail. However I
have had these problems making Stackless interoperate
with the Twisted Networking framework. I do a few
1. Run Twisted and Stackless in seperate threads
(Twisted has a callFromThread() and callInThread
1A. In my case, I have the Stackless and Twisted
threads share a dequeue. I am being conservative; I
could probably use a channel.
1B. I isolate Twisted and Stackless functionality.
2. From experience, I have found that in order to
avoid Stackless Python's notion of "deadlocking" and
to give various tasklets a chance, I do the following.
Note : note in the case of deque, I have to do this.
#this could be also channel.balance > 0 )
if len(queue) > 0:
message = channel.pop()
# do something
# give non-blocking tasklets a chance
# I also use the polling to run a "soft" clock
# for a scheduler.
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
Stackless mailing list
Stackless at stackless.com
More information about the Stackless