[medusa] Re: [Python-Dev] Re: asyncore 2.1.1/2.2 incompatibility

Sam Rushing rushing@nightmare.com
22 Mar 2002 11:55:09 -0800


--=-Kc3AM7na1IVhufN86Hz0
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Fri, 2002-03-22 at 10:24, Jeremy Hylton wrote:
> I've seen code in ZEO that works really hard to exit the asyncore loop
> and relies on knowing how the socket map is implemented.  I think it
> does asyncore.socket_map.clear() to make sure that the next time
> around, asyncore won't find anything to do.

I've had success in another event-loop-based system with using a global
'_exit' variable along with an exception.

    try:
        while 1:
            now =3D get_now()
            sched.run_scheduled()
            while sched.num_pending():
                sched.swap_and_run()
                destroy_threads()
            if _exit:
                raise EXIT
            sched.kevent (2500, 30)
    except EXIT:
        pass

-Sam


--=-Kc3AM7na1IVhufN86Hz0
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

iD8DBQA8m4wc96I2VlFshRwRAks/AJ9wwH3CBIsyi5d4RxtaZnkjWrpV9wCfdyJ0
0hg+qUqJqw4ZoMOhsEt/9Ck=
=8Zmx
-----END PGP SIGNATURE-----

--=-Kc3AM7na1IVhufN86Hz0--