[Xorp-users] My new XorpTimer not working in PIM
swdickey at rockwellcollins.com
swdickey at rockwellcollins.com
Thu Sep 1 12:50:13 PDT 2011
Hi Hackers,
I am trying out some code inside the
pim_mre_join_prune::recompute_is_prune_desired_*** methods. After every
set_pruned_state() call I want to set my new timer to fire every 30
seconds or so. This is the code I am using, its pretty much identical to
the join_timer() which is why I'm confused that it doesn't work.
Pim_Mre_Join_Prune::recompute_is_prune_desired_****
TimeVal timeval = TimeVal(30,0);
...
set_pruned_state();
new_timer() =
pim_node().eventloop().new_oneoff_after(
timeval,
callback(this, &PimMre::new_timer_timeout));
//Later on...
void
PimMre::new_timer_timeout()
{
XLOG_TRACE(true, "New timer fired.");
}
PimMre.hh:
XorpTimer& new_timer() { return (_new_timer); }
const XorpTimer& const_new_timer() const {
return (_new_timer);
}
XorpTimer _new_timer;
//function to be called
void new_timer_timeout();
This code will run and will set the timer (new_timer().scheduled == true)
but the timer will never fire! Interestingly, if I change the time to 5
milliseconds (TimeVal timeval = TimeVal(0,5);) then the new_timer will
fire. I'm not sure if this is a timing issue or some memory is going out
of scope and the 5 msec will fire the timer before the memory is
overwritten.
Any ideas? Thanks!
S. Dickey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-users/attachments/20110901/cbbaca98/attachment.html
More information about the Xorp-users
mailing list