[Tinyos Core WG] volatiles in scheduler
John Regehr
regehr at cs.utah.edu
Thu Jul 3 13:14:52 PDT 2008
I took a quick look at the volatile variables in SchedulerBasicP and I
believe that the volatile qualifiers are not needed.
Motivations for removing these would be (1) cleaning up the code (2)
saving a few bytes of code memory and a few cycles (3) patching a
bandaid over one of the safe tinyos compiler warnings.
Probably now is not the time but perhaps I'll remove these after 2.1.
Just as a note: ever since David added compiler barriers to
nesc_atomic_start/end there are only three valid reasons to use volatile
in TinyOS:
- to prevent the compiler from caching racing variables in registers
(this is never a problem for non-racing variables)
- accessing HW registers
- (very occasionally) in library code to avoid potential warnings if a
client of the library passes a volatile-qualified argument
John
More information about the Tinyos-2.0wg
mailing list