Menu

#242 Timer issue in VirtualizeTimerC$fireTimers

v2.0
open
TinyOS 2.x (11)
8
2007-07-13
2006-10-06
Ian Elbury
No

Problem:

If a timer is started from another timers fired
event, there is the possibility of the timer firing
immediatly. If the timer is started from a task, then
everything works correctly.

This problem is caused by the fact that the
variable 'now' is passed into fireTimers and is stale
if any timers take longer then one tick of the clock
to process. This problem is especially evident on
some platforms when running with a debugger (I am
running a LPC2138 arm processor).

Solution:

I solved the problem by calculating 'now' before
evaluating the requirement to signal a timer.

Change:

"uint32_t elapsed = call now - timer->t0;"

to

"uint32_t elapsed = call TimerFrom.getNow() - timer-
>t0;"

Discussion

  • Phil Levis

    Phil Levis - 2006-11-05
    • priority: 5 --> 7
    • assigned_to: nobody --> cssharp
     
  • Phil Levis

    Phil Levis - 2006-12-15
    • labels: 340523 --> TinyOS 2.x
     
  • David Gay

    David Gay - 2007-06-05

    Logged In: YES
    user_id=398311
    Originator: NO

    This needs fixing.

     
  • David Gay

    David Gay - 2007-06-05
    • assigned_to: cssharp --> idgay
     
  • Phil Levis

    Phil Levis - 2007-07-13
    • priority: 7 --> 8