[Python-Dev] Re: [Stackless] Stackless Design Q.

Sam Rushing rushing@nightmare.com
19 Feb 2002 23:41:39 -0800


--=-o0D+Wc9k+nOeeoHZukjD
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

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
>=20
> 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=3D()):
        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


--=-o0D+Wc9k+nOeeoHZukjD
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQA8c1Mz96I2VlFshRwRAjTiAJ4opHWSmb45l5YgaroZoa3Oy6KhbgCgmLVT
Vbg1DWF5JI62zVhxTtvlbHA=
=ptSd
-----END PGP SIGNATURE-----

--=-o0D+Wc9k+nOeeoHZukjD--