This is because you assign a value to a global variable in an asys event.
It should be protected by "atomic".

Hui Kang

On 7/5/2007, "Philip Levis" <[EMAIL PROTECTED]> wrote:

>On Jul 5, 2007, at 9:36 AM, Jordi Casals wrote:
>
>> Hi,
>>
>> I have a little problem. My program uses async events (from Uart0
>> on micaz, T2) and I change a variable into them. I know that it is
>> dangerous and I use the atomic statement when I want to change the
>> value in another function... My explanation is very bad, and I put
>> an example:
>>
>> ____________________________________________________
>> ...
>> uint8_t byteRx;
>> ...
>>
>> async event void Uart.receivedByte(uint8_t byte){
>>     byteRx = byte;
>>     post uartReceivedByte();
>> }
>>
>> task void uartReceivedByte(){
>>     ...
>> }
>>
>> void anotherFunction(){
>>     atomic anotherVariable = byteRx;
>> }
>> _______________________________________________________
>>
>> Well, when I compile, there is a warning:
>> warning: non-atomic accesses to shared variable `byteRx'
>> refered to the declaration of the variable.
>>
>> How can I solve this warning??
>> (I've tried to do this: atomic uint8_t byteRx; and there is an error)
>>
>> Thank you!
>>
>
>Please read the TinyOS programming manual.
>
>http://www.tinyos.net/tinyos-2.x/doc
>
>Phil
>
>_______________________________________________
>Tinyos-help mailing list
>[email protected]
>https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to