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

Comparing gvpe/src/iom.h (file contents):
Revision 1.22 by pcg, Thu Nov 11 17:41:55 2004 UTC vs.
Revision 1.26 by pcg, Wed Dec 15 02:59:55 2004 UTC

1/* 1/*
2 iom.h -- generic I/O multiplexor 2 iom.h -- generic I/O multiplexer
3 Copyright (C) 2003, 2004 Marc Lehmann <pcg@goof.com> 3 Copyright (C) 2003, 2004 Marc Lehmann <pcg@goof.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
41# define IOM_IDLE 0 41# define IOM_IDLE 0
42#endif 42#endif
43#ifndef IOM_SIG 43#ifndef IOM_SIG
44# define IOM_SIG 0 44# define IOM_SIG 0
45#endif 45#endif
46#ifndef IOM_ACCURACY
47# define IOM_ACCURACY 0.001 // start timers at most this much earlier (can be 0)
48#endif
49 46
50typedef double tstamp; 47typedef double tstamp;
51extern tstamp NOW; 48extern tstamp NOW;
52 49
53struct watcher; 50struct watcher;
72 void erase_unordered (unsigned int pos) 69 void erase_unordered (unsigned int pos)
73 { 70 {
74 watcher *w = (*this)[this->size () - 1]; 71 watcher *w = (*this)[this->size () - 1];
75 this->pop_back (); 72 this->pop_back ();
76 73
77 if (this->size ()) 74 if (!this->empty ())
78 if (((*this)[pos] = w)) // '=' is correct! 75 if (((*this)[pos] = w)) // '=' is correct!
79 w->active = pos + 1; 76 w->active = pos + 1;
80 } 77 }
81}; 78};
82 79
87 84
88 template<class watcher> 85 template<class watcher>
89 static void unreg (watcher &w, io_manager_vec<watcher> &queue); 86 static void unreg (watcher &w, io_manager_vec<watcher> &queue);
90 87
91public: 88public:
89#if IOM_TIME
90 // fetch time only
91 static tstamp now ();
92
93 // set NOW
94 static void set_now ();
95#endif
96
92 // register a watcher 97 // register a watcher
93#if IOM_IO 98#if IOM_IO
94 static void reg (io_watcher &w); static void unreg (io_watcher &w); 99 static void reg (io_watcher &w); static void unreg (io_watcher &w);
95#endif 100#endif
96#if IOM_TIME 101#if IOM_TIME

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines