[Tinyos-help] A question on sync/async code

Philip Levis pal at cs.stanford.edu
Mon Aug 13 09:56:51 PDT 2007


On Aug 12, 2007, at 9:25 PM, Bin Lei wrote:

> In the user manual, AC is defined as code is reachable from at least
> one interrrupt handler; while SC is code only reachable from tasks.
>
> But there are many event handler that are not tagged using async, are
> they async or sync?
> e.g. in Blink example,  three timer could fire simultaneously
> according to their frequency, and they triggered different control
> flow, is it possible that interfere with each other, i.e. one event
> handler is preempted by another?
>
>   event void Timer0.fired()
>   {
>     dbg("BlinkC", "Timer 0 fired @ %s.\n", sim_time_string());
>     call Leds.led0Toggle();
>   }
>   event void Timer1.fired()
>   {
>     dbg("BlinkC", "Timer 1 fired @ %s \n", sim_time_string());
>     call Leds.led1Toggle();
>   }
>   event void Timer2.fired()
>   {
>     dbg("BlinkC", "Timer 2 fired @ %s.\n", sim_time_string());
>     call Leds.led2Toggle();
>   }

All commands and events that do not have the async keyword are sync.

Phil


More information about the Tinyos-help mailing list