On Tuesday 12 September 2006 09:03 am, yicheng wrote: > From: Pablo Gil Montaño [mailto:[EMAIL PROTECTED] > > As far as I know, tasks do not preempt other tasks, but events can always > > preempt tasks or events no matter whether they are async or not. Tasks are > > executed only when there is nothing else to do, and can be preempted by > > events, but not by other tasks. > > I dont think sync events can preempt other tasks or events, thats the > difference between async and sync events.
An event never causes preemption. Events are 'callback'-like functions that can be initiated by signalling them. When an event is signalled, control is passed to the event as if it were a function call. When the event completes, control returns to the code that signalled the event at the instruction immediately following the signal call. An async event may seem like it preempts a task, but it doesn't really. An interrupt causes preemption, causing execution of an interrupt handler in async context. Most handlers signal an async event on an interface, effectively "converting" the interrupt into an event invocation. > > If someone knows exactly the difference between async and sync events > > please pots, I don't see any difference. The async keyword tells nesC that the code block is valid for execution within async context, so code running in async context can only call async commands or signal async events. _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help