On Tue, Nov 2, 2010 at 7:48 AM, Heinrich Schmetterling
<[email protected]> wrote:
> I have an architecture where worker tasklets are repeatedly creating other
> worker tasklets when traversing a tree structure. I want a special tasklet
> to be runnable while the set of worker tasklets is not empty. Is there a way
> to do this using some feature of stackless without having to explicitly keep
> track of how many runnable worker tasklets exist at any given time? For
> example, I'm trying to avoid keeping a global counter somewhere and
> observing that counter in the special tasklet every time it regains control.

Add all worker tasklets to a weakref set, and when the special tasklet
wakes to an empty weakref set, block it on a channel.  Then when
creating a worker tasklet and adding it to the set, if the special
tasklet is blocked on a channel, wake it up to continue being
scheduled?

Something like that.  This is something you would do in "user space",
in any case :-)

Cheers,
Richard.

_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to