--- gvpe/src/iom.h 2003/03/21 20:33:36 1.1 +++ gvpe/src/iom.h 2003/03/21 21:17:02 1.2 @@ -25,9 +25,9 @@ #include "slog.h" -typedef double timestamp; +typedef double tstamp; -extern timestamp NOW; +extern tstamp NOW; template class callback; struct io_watcher; @@ -89,38 +89,44 @@ { return prxy->call (obj, meth, arg); } + + void stop () + { + iom.unreg (this); + } }; struct io_watcher : callback { template - io_watcher (int fd, short events, O1 *object, void (O2::*method)(short revents)) + io_watcher (O1 *object, void (O2::*method)(short revents)) : callback(object,method) + { } + + void start (int fd, short events) { iom.reg (fd, events, this); } - ~io_watcher () - { - iom.unreg (this); - } }; -struct time_watcher : callback { - timestamp at; - - void set (timestamp when); +struct time_watcher : callback { + tstamp at; template - time_watcher (timestamp when, O1 *object, void (O2::*method)(timestamp &)) - : callback(object,method) - , at(when) + time_watcher (O1 *object, void (O2::*method)(tstamp &)) + : callback(object,method) + { } + + void set (tstamp when); + + void trigger () { - iom.reg (this); + call (at); } - ~time_watcher () + void start (tstamp when) { - iom.unreg (this); + set (when); } };