[Xorp-users] My new XorpTimer not working in PIM

Ben Greear greearb at candelatech.com
Thu Sep 1 13:35:11 PDT 2011


On 09/01/2011 12:50 PM, swdickey at rockwellcollins.com wrote:
>
> 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); }
> constXorpTimer& const_new_timer() const{
> return(_new_timer);
> }
>
> XorpTimer _new_timer;
>
> //function to be called
> voidnew_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.

Maybe the callback method needs to be a static method or plain
function instead of a class member?

Thanks,
Ben

>
> Any ideas? Thanks!
>
> S. Dickey
>
>
> _______________________________________________
> Xorp-users mailing list
> Xorp-users at xorp.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-users


-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



More information about the Xorp-users mailing list