[Stackless] Re: return values from tasklets

Christian Tismer tismer at stackless.com
Thu Jan 29 20:10:16 CET 2004


Tom Locke wrote:

>>What you want is:
>>mytasklet = tasklet.new(foo)
>>mytasklet.letloose() 
>>a = myownstufftodo.doit()
>>b = thatotherresult = mytasklet.wait()
>>return a,b
> 
> 
> Yep - this makes sense to me. wait() is sometimes called join(), as in
> join two threads into one. I was looking for this in stackless a while
> back.
> 
> I guess you'll need to store the return value somewhere, in case the
> tasklet finishes before the call to wait(). Maybe this should be
> visible, as in: 

Currently there is a multi-purpose field in tasklets, the tempval.
It has some special meaning during tasklet startup, but later
on it *is* actually used to store the current tasklet return
value in soft-switching, *and* it is used for data transfer
via channels.
It might make sense to just keep the data there, instead
of just decreffing it on tasklet_end. Some other code might
want to fetch the value before the tasklet is destructed.
This would be a quite trivial change.

ciao - chris
-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list