[Tinyos-help] __attribute__ ((C, spontaneous))
David Gay
dgay42 at gmail.com
Wed Jul 5 17:32:41 PDT 2006
On 7/5/06, Adam <shiyuan69 at gmail.com> wrote:
> Thanks. Does this mean it is recommended to add this attibute to all global
> C functions? For my case, I write some buffer manage functions -- multiple
> modules can call those functions -- I added "atomic" in each of those
> functions, will it be removed by compiler (since atomic is not a c KEYWORD)
> if I use these attributes? I ASSUME NOT. Please correct me if I am wrong.
> Thanks.
If your function is called from a nesC component, you don't need
spontaneous. I'm unclear what link you see between "spontaneous"
(telling the nesC optimiser that it shouldn't remove an apparently
uncalled function) and "atomic" (a nesC extension to C relating to
atomic execution of a block of a block of code) (so, no, adding or
removing spontaneous is not going to make the nesC compiler add or
remove atomic statements...).
Note that to use atomic in your "C" functions (well, they aren't
really C once you use atomic...), you'll need to either:
- include your C files in some nesC component with #include (nesC 1.2
or later required)
- add a #undef atomic to your C files before the first use of atomic
(not guaranteed to continue working into the indefinite future)
David Gay
More information about the Tinyos-help
mailing list