[Click] Timer !
el.drago@tiscali.it
el.drago at tiscali.it
Mon Jul 23 11:35:14 EDT 2007
Hi to all!
I am trying to introduce a very (hopefully) simple timer in my
module.
It WOULD simply call a function when it expires (well, it will be
reset many times and only if nobody resets it for some time, and its
time expires, it has to call a function, then re-reset itself).
Searching in the mailing list i have found this tip:
// Runs the run_timer function upon expiry
class MyElement: public Element {
public:
…
void run_timer();
private:
Timer timer;
}
MyElement::MyElement(): timer(this){
timer.initialize(this);
timer.schedule_after_ms(1000);
return 0;
}
void MyElement ::run_timer(){
// do something
timer.schedule_after_ms(1000);
}
Well, I tried to fit this in my module but first of all i got an
error:
"error: returning a value from a constructor"
so I pull out the "return 0" from the constructor (originally in my
code there isn't it).
After fixing minor errors i got only 2 identical warnings:
"warning: ‘schedule_after_ms’ is deprecated (declared at ..
/include/click/timer.hh:212)"
but I have no idea how to fix them.
So i try to run click but.. DAMN! as I hit -return- i got:
"click: ../lib/timer.cc:130: void Timer::schedule_at(const
Timestamp&): Assertion `_router && initialized()' failed.
Aborted"
I "googled" for at least 3 hours searching how to make this
(apparently) easy timer (or better a trigger for time-out) but, really
i didn't found real help.
Anyone can advice me how I could write it down, or knows where i can
find an easy explanation [I tried understanding timer.cc and .hh but it
doesn't help me :( ]
Thanks in advance for any kind of help.
Massimo
_______________________________________
Stampa on line i tuoi ricordi con Tiscali.Photo
http://photo.tiscali.it//
More information about the click
mailing list