--- rxvt-unicode/src/iom.h 2004/02/13 12:16:21 1.11 +++ rxvt-unicode/src/iom.h 2004/04/02 14:30:06 1.12 @@ -40,6 +40,9 @@ #ifndef IOM_IDLE # define IOM_IDLE 0 #endif +#ifndef IOM_SIG +# define IOM_SIG 0 +#endif typedef double tstamp; extern tstamp NOW; @@ -57,6 +60,9 @@ #if IOM_IDLE struct idle_watcher; #endif +#if IOM_SIG +struct sig_watcher; +#endif template struct io_manager_vec : vector { @@ -88,6 +94,11 @@ #if IOM_IDLE io_manager_vec iw; #endif +#if IOM_SIG + typedef io_manager_vec sig_vec; + vector sw; + static void sighandler (int signum); +#endif template void reg (watcher *w, io_manager_vec &queue); @@ -109,6 +120,9 @@ #if IOM_IDLE void reg (idle_watcher *w); void unreg (idle_watcher *w); #endif +#if IOM_SIG + void reg (sig_watcher *w); void unreg (sig_watcher *w); +#endif void loop (); @@ -194,5 +208,20 @@ }; #endif +#if IOM_SIG +struct sig_watcher : watcher, callback1 { + int signum; + + void start (int signum); + void stop () { iom.unreg (this); } + + template + sig_watcher (O1 *object, void (O2::*method) (sig_watcher &)) + : callback1 (object,method), signum (-1) + { } + ~sig_watcher () { stop (); } +}; +#endif + #endif