… | |
… | |
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 |
46 | |
49 | |
47 | typedef double tstamp; |
50 | typedef double tstamp; |
48 | extern tstamp NOW; |
51 | extern tstamp NOW; |
49 | |
52 | |
50 | struct watcher; |
53 | struct watcher; |
… | |
… | |
64 | struct sig_watcher; |
67 | struct sig_watcher; |
65 | #endif |
68 | #endif |
66 | |
69 | |
67 | template<class watcher> |
70 | template<class watcher> |
68 | struct io_manager_vec : vector<watcher *> { |
71 | struct io_manager_vec : vector<watcher *> { |
69 | #if IOM_CHECK |
|
|
70 | bool activity; |
|
|
71 | #endif |
|
|
72 | |
|
|
73 | void erase_unordered (unsigned int pos) |
72 | void erase_unordered (unsigned int pos) |
74 | { |
73 | { |
75 | watcher *w = (*this)[this->size () - 1]; |
74 | watcher *w = (*this)[this->size () - 1]; |
76 | this->pop_back (); |
75 | this->pop_back (); |
77 | |
76 | |
78 | if (this->size ()) |
77 | if (this->size ()) |
79 | if ((*this)[pos] = w) |
78 | if (((*this)[pos] = w)) // '=' is correct! |
80 | w->active = pos + 1; |
79 | w->active = pos + 1; |
81 | } |
80 | } |
82 | }; |
81 | }; |
83 | |
82 | |
84 | // only used as a namespace, and for initialisation purposes |
83 | // only used as a namespace, and for initialisation purposes |