Hi, Acoording to *TinyOS Programming Manual<http://www.tinyos.net/tinyos-2.x/doc/pdf/tinyos-programming.pdf>*, by default one function (it could be event or command) is sync and it could only be preempted by an async function (for example: an interrupt handler). But, obviously, *uartIn* and *uartQueue* is private and can't be accessed in any async function. So, I think it's useless to put *atomic* here.
Best Regards, Ruitao Xu 在 2011年4月14日 上午1:26,Sergio Valcarcel <[email protected]>写道: > Hi, > > I imagine that either "uartQueue" or "uartIn" could be accessed from > another method. If it is not the case I do not see the usefulness > either. > > Have a great (perhaps sunny-spring) day!! > Sergio > > On Wed, Apr 13, 2011 at 9:55 AM, 徐瑞涛 <[email protected]> wrote: > > Hi, > > > > I'm also confused. Looking forward to detailed explanation. > > > > Best Regards, > > Ruitao Xu > > > > 在 2011年4月11日 上午10:07,许长亮 <[email protected]>写道: > >> > >> Hi: > >> > >> I am confued by the following keyword "atomic": > >> > >> > >> message_t* receive(message_t *msg, void *payload, uint8_t len) { > >> message_t *ret = msg; > >> > >> atomic { > >> if (!uartFull) > >> { > >> ret = uartQueue[uartIn]; > >> uartQueue[uartIn] = msg; > >> ... > >> } > >> ... > >> } > >> > >> I think the context of these codes excute is "task specific ", no > >> interrupt occurs. so there is no need to use the keyword "atomic". any > on > >> give me a shorter explanation? thanks! > >> > >> > >> Best regards! > >> > >> [email protected] > >> _______________________________________________ > >> Tinyos-help mailing list > >> [email protected] > >> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > > > > > > -- > > Be Your Personal Best! > > > > _______________________________________________ > > Tinyos-help mailing list > > [email protected] > > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > -- Be Your Personal Best!
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
