[Stackless] Stackless API

Christian Tismer tismer at stackless.com
Thu Jan 29 20:31:14 CET 2004

Giovanni Bajo wrote:

[small annotations, still not taking position]


> What does Thread.start() do in Java? In Stackless, we just create a tasklet to
> make it runnable. I then pause/continue it by inserting/removing it from the
> scheduler.

Souds like start/stop would be good replacements
of insert/remove. The latter are too implementation
centric (which I tend to do all the time).

>>>>* If the tasklet has a single frame and it performs a python
>>>>  "return", the caller of tasklet.run gets the return value.
>>The caller or run() is somewhere else by now, because run() does not
>>block. That's the whole point!
> What run() does right now is blocking the current tasklet. It's basically a
> yield_to().

Eek! Here I need to clarify the mess that basically I created:
there is stackless.run and tasklet.run.

- stackless.run does not really block, but effectively it does,
   by removing the main tasklet from the runnables into some
   dormant state, until no other tasklets can be run, or
   one has run out of time.
- tasklet.run does not block at all. It just makes sure that
   the tasklet is switched to right now, and it places it into
   a position that the "caller" is run right after it.
   This was never thought as a call-like thing, just a little
   shuffling of priorities.
   Ok, in a sense it is a yield_to. I think you are referring to this.


> I must say that I always liked become()/capture(). Yes, they look weird at
> first, but they save you quite a lot of forwarding code in many situations. I
> hit segfaults using them though, and Christian adviced me to just get rid of
> them in my code. That's what I did, but I wouldn't mind being able to use them
> again in the future.

Measuring the huge amount of time I've put into debugging
these, we might keep them? :-)
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

More information about the Stackless mailing list