[Stackless] Stackless Design Q.

Sam Rushing rushing at nightmare.com
Wed Feb 20 08:41:39 CET 2002


On Tue, 2002-02-19 at 11:15, Christian Tismer wrote:
> Again, What is the name of this function/method, and
> where does it belong?
> It
> - unblocks another tasklet
> - transfers data
> - does not block anything
> - schedules the other tasklet
> 
> Or is this a bad design at all?

In our current system, this function is called 'schedule()';
and it takes an 'args' tuple.  It doesn't transfer control, it just
makes the other coro ready to run ASAP. [i.e., next trip through the
event loop it will be added to the set of 'runnable' coros].

Here is our coro::condition_variable::wake_one() for context:

    def wake_one (self, args=()):
        for coro in self._waiting:
            try:
                schedule (coro, args)
            except ScheduleError:
                pass
            else:
                self._waiting.pop(0)
                return 1
        else:
            return 0


[ScheduleError is thrown if the coro has already been scheduled]

-Sam

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part
URL: <http://www.stackless.com/pipermail/stackless/attachments/20020219/330e28ef/attachment.pgp>


More information about the Stackless mailing list