event handling: asyncore, signals, idle handler?

Kragen Sitaker kragen at dnaco.net
Mon Aug 28 06:13:48 EDT 2000


I'd like to write an interactive keystroke-driven tty Unix application
that does work in the background while waiting for you to type
something.  Being an interactive Unix application, it'll need to handle
SIGTSTP and SIGCONT at least, as well as normal user input.  

It looks like I can write an event loop of my own, using asyncore to
handle the stdin and stdout, using the signal module to handle signals,
and running background processing in between.  Has someone already done
this?  Is there a way I can do priority scheduling with asyncore (i.e.
not run background processing until I call poll() and it fails to run
any signal handlers) instead of round-robin?

I'm most impressed with Python's signal module, by the way.  Perl's is
too close to the C semantics to be reliably usable for this kind of
thing.
-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Perilous to all of us are the devices of an art deeper than we ourselves
possess.
                -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"]





More information about the Python-list mailing list