0

I am trying to create a new class in NachOS called alarmclock. In it, I need to create a timer object to use to trigger interrupts. In timer.cc, the constructor is

Timer::Timer(VoidFunctionPtr timerHandler, int callArg, bool doRandom)

Can someone please explain to me what inputs this constructor will take, and what VoidFunctionPtr timerHandler is and how it works? I have absolutely no idea what arguments to pass to this function so I'm just stuck here unable to do anything so far. Any help would be greatly appreciated.

I know it is a pointer to a function, but I do not understand how it works.

Ry-
  • 218,210
  • 55
  • 464
  • 476
Irtza
  • 33
  • 1
  • 6
  • Seems like a pointer to a `void` function. Pass it a void function. If that gives you an error, fix it appropriately. – Ry- Sep 29 '13 at 14:50
  • You should add your own answer! It could help somebody in the future. – Ry- Sep 29 '13 at 16:05
  • timeHandler is basically a pointer to the function we want to execute using the timer. callArg is the input to that function and doRandom is a Boolean for a random Time splicer that generates random interval alarms. It is used when we do not have or need a fixed interval timer – Irtza Sep 29 '13 at 20:08
  • As an answer! You can accept it in two days. And we encourage that :) – Ry- Sep 29 '13 at 20:08

1 Answers1

0

timeHandler is basically a pointer to the function we want to execute using the timer. callArg is the input to that function and doRandom is a Boolean for a random Time splicer that generates random interval alarms. It is used when we do not have or need a fixed interval timer

Irtza
  • 33
  • 1
  • 6