ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/iom.h
(Generate patch)

Comparing rxvt-unicode/src/iom.h (file contents):
Revision 1.11 by pcg, Fri Feb 13 12:16:21 2004 UTC vs.
Revision 1.12 by pcg, Fri Apr 2 14:30:06 2004 UTC

38# define IOM_CHECK 0 38# define IOM_CHECK 0
39#endif 39#endif
40#ifndef IOM_IDLE 40#ifndef IOM_IDLE
41# define IOM_IDLE 0 41# define IOM_IDLE 0
42#endif 42#endif
43#ifndef IOM_SIG
44# define IOM_SIG 0
45#endif
43 46
44typedef double tstamp; 47typedef double tstamp;
45extern tstamp NOW; 48extern tstamp NOW;
46 49
47struct watcher; 50struct watcher;
54#if IOM_CHECK 57#if IOM_CHECK
55struct check_watcher; 58struct check_watcher;
56#endif 59#endif
57#if IOM_IDLE 60#if IOM_IDLE
58struct idle_watcher; 61struct idle_watcher;
62#endif
63#if IOM_SIG
64struct sig_watcher;
59#endif 65#endif
60 66
61template<class watcher> 67template<class watcher>
62struct io_manager_vec : vector<watcher *> { 68struct io_manager_vec : vector<watcher *> {
63#if IOM_CHECK 69#if IOM_CHECK
86 io_manager_vec<time_watcher> tw; 92 io_manager_vec<time_watcher> tw;
87#endif 93#endif
88#if IOM_IDLE 94#if IOM_IDLE
89 io_manager_vec<idle_watcher> iw; 95 io_manager_vec<idle_watcher> iw;
90#endif 96#endif
97#if IOM_SIG
98 typedef io_manager_vec<sig_watcher> sig_vec;
99 vector<sig_vec *> sw;
100 static void sighandler (int signum);
101#endif
91 102
92 template<class watcher> 103 template<class watcher>
93 void reg (watcher *w, io_manager_vec<watcher> &queue); 104 void reg (watcher *w, io_manager_vec<watcher> &queue);
94 105
95 template<class watcher> 106 template<class watcher>
106#if IOM_CHECK 117#if IOM_CHECK
107 void reg (check_watcher *w); void unreg (check_watcher *w); 118 void reg (check_watcher *w); void unreg (check_watcher *w);
108#endif 119#endif
109#if IOM_IDLE 120#if IOM_IDLE
110 void reg (idle_watcher *w); void unreg (idle_watcher *w); 121 void reg (idle_watcher *w); void unreg (idle_watcher *w);
122#endif
123#if IOM_SIG
124 void reg (sig_watcher *w); void unreg (sig_watcher *w);
111#endif 125#endif
112 126
113 void loop (); 127 void loop ();
114 128
115 io_manager (); 129 io_manager ();
192 { } 206 { }
193 ~idle_watcher () { stop (); } 207 ~idle_watcher () { stop (); }
194}; 208};
195#endif 209#endif
196 210
197#endif 211#if IOM_SIG
212struct sig_watcher : watcher, callback1<void, sig_watcher &> {
213 int signum;
198 214
215 void start (int signum);
216 void stop () { iom.unreg (this); }
217
218 template<class O1, class O2>
219 sig_watcher (O1 *object, void (O2::*method) (sig_watcher &))
220 : callback1<void, sig_watcher &> (object,method), signum (-1)
221 { }
222 ~sig_watcher () { stop (); }
223};
224#endif
225
226#endif
227

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines