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

Comparing gvpe/src/iom.C (file contents):
Revision 1.13 by pcg, Sat Jan 17 01:18:36 2004 UTC vs.
Revision 1.16 by pcg, Sat Jan 17 16:49:01 2004 UTC

19 19
20#include <cstdio> 20#include <cstdio>
21#include <cstdlib> 21#include <cstdlib>
22#include <cerrno> 22#include <cerrno>
23 23
24#include <sys/time.h>
25
26#if 1 // older unices need these includes for select(2)
27# include <unistd.h>
28# include <sys/types.h>
29#endif
30
31// if the BSDs would at least be marginally POSIX-compatible.. *sigh*
32// until that happens, sys/select.h must come last
24#include <sys/select.h> 33#include <sys/select.h>
25#include <sys/time.h>
26 34
27#include "iom.h" 35#include "iom.h"
28 36
29// TSTAMP_MAX must still fit into a positive struct timeval 37// TSTAMP_MAX must still fit into a positive struct timeval
30#define TSTAMP_MAX (double)(1UL<<31) 38#define TSTAMP_MAX (double)(1UL<<31)
39
40// this is a dummy time watcher to ensure that the first
41// time watcher is _always_ valid, this gets rid of a lot
42// of null-pointer-checks
43// (must come _before_ iom is being defined)
44static struct tw0 : time_watcher {
45 void cb (time_watcher &w)
46 {
47 // should never get called
48 // reached end-of-time, or tstamp has a bogus definition,
49 // or compiler initilization order broken, or somethine else :)
50 abort ();
51 }
52
53 tw0()
54 : time_watcher (this, &tw0::cb)
55 { }
56} tw0;
31 57
32tstamp NOW; 58tstamp NOW;
33static bool iom_valid; 59static bool iom_valid;
34io_manager iom; 60io_manager iom;
35 61
222 break; 248 break;
223#endif 249#endif
224 } 250 }
225} 251}
226 252
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
230static 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
243io_manager::io_manager () 253io_manager::io_manager ()
244{ 254{
245 iom_valid = true; 255 iom_valid = true;
246 256
247#if IOM_TIME 257#if IOM_TIME

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines