[Stackless] modal

Ben ben at medianstrip.net
Thu Jan 20 21:34:12 CET 2005

Hi --

stackless seems cool.  i have a question about it though.

the short question:

it seems that channels are not pickleable.  i want to write a function
"hibernate" which

1) suspends and pickles the current tasklet, and
2) returns a value when woken up.

the natural way to do this would be to block on the receiving end of a
channel.  unfortunately i can't pickle in this case, because channels
can't be pickled -- the program need to stop and start.  i guess i can
recover the response from a global variable, but that seems like a
hack, and prone to error (if multiple tasklets are woken up at a time,
for example.)  is there a way to block on some kind of data and be

the long question:

i would like to have something like call/cc.  i know this is not a
goal of stackless, but nonetheless i would like it.

why?  i'm trying make a "modal email framework" (ala modal web
frameworks, see 

Basically I (and a lot of other people) want to be able to write code

def foo():
     do somthing
     response = sendMsgAndWaitForResponse(msg)
     do some more stuff
     response = sendMsgAndWaitForResponse(msg2)
     do some more stuff...

where sendMsgAndWaitForResponse() should sleep the 'tasklet', pickle
it and stash it away somewhere, and send the message to the user.
when the response comes, it should get unpickled and run from the
place where it left off, getting the data of the response in some way.

in scheme/smalltalk/ruby i would do this with call/cc.  tasklets
should allow me to do the same thing, but i can't quite figure out

Georg Bauer figured out how to do it with greenlets:


mostly i can't figure out what "become" and "capture" do, and i have
yet to successfully call them!

help!  looking for more docs / samples than in the release / wiki,
especially on the mysterious functions "become" and "capture."

thanks, B

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list