/*
- iom.h -- generic I/O multiplexor
+ iom.h -- generic I/O multiplexer
Copyright (C) 2003, 2004 Marc Lehmann <pcg@goof.com>
This program is free software; you can redistribute it and/or modify
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IOM_H__
template<class watcher>
struct io_manager_vec : vector<watcher *> {
-#if IOM_CHECK
- bool activity;
-#endif
-
void erase_unordered (unsigned int pos)
{
watcher *w = (*this)[this->size () - 1];
this->pop_back ();
- if (this->size ())
- if ((*this)[pos] = w)
+ if (!this->empty ())
+ if (((*this)[pos] = w)) // '=' is correct!
w->active = pos + 1;
}
};
static void unreg (watcher &w, io_manager_vec<watcher> &queue);
public:
+#if IOM_TIME
+ // fetch time only
+ static tstamp now ();
+
+ // set NOW
+ static void set_now ();
+#endif
+
// register a watcher
#if IOM_IO
static void reg (io_watcher &w); static void unreg (io_watcher &w);