[Tinyos-help] async and warnings

Jordi Casals jordi.casals at gmail.com
Thu Jul 5 09:36:17 PDT 2007


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!

-- 
Jordi Casals
E-mail: jordi.casals at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20070705/16b33515/attachment.htm


More information about the Tinyos-help mailing list