tac0S
Template Affectional Command Operating System
timer.h
1 
22 
23 #ifndef TIMER_H
24 #define TIMER_H
25 
26 #include "copyright.h"
27 #include "utility.h"
28 
30 class Timer {
31  public:
32  Timer(VoidFunctionPtr timerHandler, int callArg, bool doRandom);
33  // Initialize the timer, to call the interrupt
34  // handler "timerHandler" every time slice.
35  ~Timer() {}
36 
37 // Internal routines to the timer emulation -- DO NOT call these
38 
39  void TimerExpired(); // called internally when the hardware
40  // timer generates an interrupt
41 
42  int TimeOfNextInterrupt(); // figure out when the timer will generate
43  // its next interrupt
44 
45  private:
46  bool randomize; // set if we need to use a random timeout delay
47  VoidFunctionPtr handler; // timer interrupt handler
48  int arg; // argument to pass to interrupt handler
49 
50 };
51 
52 #endif // TIMER_H
The following class defines a hardware timer.
Definition: timer.h:30
int TimeOfNextInterrupt()
Timer::TimeOfNextInterrupt.
Definition: timer.cc:82
void TimerExpired()
Timer::TimerExpired Routine to simulate the interrupt generated by the hardware timer device...
Definition: timer.cc:65
Miscellaneous useful definitions, including debugging routines.
Timer(VoidFunctionPtr timerHandler, int callArg, bool doRandom)
Timer::Timer Initialize a hardware timer device. Save the place to call on each interrupt, and then arrange for the timer to start generating interrupts.
Definition: timer.cc:47