… | |
… | |
27 | #include "iom.h" |
27 | #include "iom.h" |
28 | |
28 | |
29 | // TSTAMP_MAX must still fit into a positive struct timeval |
29 | // TSTAMP_MAX must still fit into a positive struct timeval |
30 | #define TSTAMP_MAX (double)(1UL<<31) |
30 | #define TSTAMP_MAX (double)(1UL<<31) |
31 | |
31 | |
|
|
32 | // this is a dummy time watcher to ensure that the first |
|
|
33 | // time watcher is _always_ valid, this gets rid of a lot |
|
|
34 | // of null-pointer-checks |
|
|
35 | // (must come _before_ iom is being defined) |
|
|
36 | static struct tw0 : time_watcher { |
|
|
37 | void cb (time_watcher &w) |
|
|
38 | { |
|
|
39 | // should never get called |
|
|
40 | // reached end-of-time, or tstamp has a bogus definition, |
|
|
41 | // or compiler initilization order broken, or somethine else :) |
|
|
42 | abort (); |
|
|
43 | } |
|
|
44 | |
|
|
45 | tw0() |
|
|
46 | : time_watcher (this, &tw0::cb) |
|
|
47 | { } |
|
|
48 | } tw0; |
|
|
49 | |
32 | tstamp NOW; |
50 | tstamp NOW; |
33 | static bool iom_valid; |
51 | static bool iom_valid; |
34 | io_manager iom; |
52 | io_manager iom; |
35 | |
53 | |
36 | template<class watcher> |
54 | template<class watcher> |
… | |
… | |
222 | break; |
240 | break; |
223 | #endif |
241 | #endif |
224 | } |
242 | } |
225 | } |
243 | } |
226 | |
244 | |
227 | // this is a dummy time watcher to ensure that the first |
|
|
228 | // time watcher is _always_ valid, this gets rid of a lot |
|
|
229 | // of null-pointer-checks |
|
|
230 | static struct tw0 : time_watcher { |
|
|
231 | void cb (time_watcher &w) |
|
|
232 | { |
|
|
233 | // should never get called |
|
|
234 | // reached end-of-time, or tstamp has a bogus definition :) |
|
|
235 | abort (); |
|
|
236 | } |
|
|
237 | |
|
|
238 | tw0() |
|
|
239 | : time_watcher (this, &tw0::cb) |
|
|
240 | { } |
|
|
241 | } tw0; |
|
|
242 | |
|
|
243 | io_manager::io_manager () |
245 | io_manager::io_manager () |
244 | { |
246 | { |
245 | iom_valid = true; |
247 | iom_valid = true; |
246 | |
248 | |
247 | #if IOM_TIME |
249 | #if IOM_TIME |
248 | set_now (); |
250 | set_now (); |
249 | |
251 | |
250 | tw0.start (TSTAMP_MAX); |
252 | tw0.start (TSTAMP_MAX); |
|
|
253 | printf ("abort, %f but inly on %f\n", NOW, tw0.at); |
251 | #endif |
254 | #endif |
252 | } |
255 | } |
253 | |
256 | |
254 | io_manager::~io_manager () |
257 | io_manager::~io_manager () |
255 | { |
258 | { |