On Jun 5, 2010, at 2:24 PM, Miklos Maroti wrote: > Hi Xiaohui, > > The tinyos programming book is right. I have checked that > CtpRoutingEngineP and it has no async command or event, so everything > is updated in synchronous context. I also do not see that a pointer > would be passed out of this module to these variables, so really all > updates are synchronous and the atomic statements should be removed. > > The ncc compiler is doing an excellent job: if you remove the atomic > statements and it does not complain, then you do not need the atomic > statements. There are only two cases where you need atomic even in > sync context: 1) if your variable is updated through a pointer in an > atomic context (which is rare, but can happen), 2) you are writing a > hardware driver doing some time sensitive stuff and you do not want > your code to be interrupted in the middle.
My only thought is that the atomic statement might have been needed for Neutron (for safe reboots), and somehow the annotation made its way into the main branch? Om? Phil _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
