[Tinyos-help] IntToRfmM.nc query

Eric Decker cire831 at gmail.com
Wed Jun 10 10:10:31 PDT 2009


I suspect that the data cell in question is used somewhere in an async
 context so thecompiler (nescc) will bit.

The thing to do is to pull the atomic and see what happens when compiled.

eric


On Wed, Jun 10, 2009 at 9:28 AM, Michael Schippling <schip at santafe.edu>wrote:

> I can't think of any good reason for the atomic
> other than to demonstrate how it's used...
>
> If there is a possibility of an interrupting process
> changing values that you are working with, then the
> atomic block is a good idea. Both src and value are
> two byte fields so something could slip in between
> the setting of the two bytes during an assignment
> and make a mess of the result.
>
> But TOS_LOCAL_ADDRESS is a constant and if the contents
> of the message were being modified by other 'processes'
> one would think that message->value would also need
> to be atomic. I stand to be corrected.
>
> You can remove the atomic and see if the compiler complains.
> If there is a possibility of multiple access it will produce
> a warning that might lead to the source.
>
> MS
>
>
> bharat naik wrote:
> > Hi,
> >
> >    I was going through Lesson 4 of the TinyOS-1.x tutorial. I didn't
> > understand why in the IntToRfmM module, inside the IntOutput.output()
> > function, the atomic statement is required i.e
> > atomic{
> > message->src = TOS_LOCAL_ADDRESS;
> > }
> > I didn't understand how message becomes a shared variable. Also, the
> > assignment of message->src to a value, is it such a long operation so as
> > to require atomicity?
> >
> >
> > Thanks,
> > Bharat.
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > Tinyos-help at millennium.berkeley.edu
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Eric B. Decker
Senior (over 50 :-) Researcher
Autonomous Systems Lab
Jack Baskin School of Engineering
UCSC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090610/3e48d101/attachment-0001.htm 


More information about the Tinyos-help mailing list