Basically, don't worry... Received messages are sent to your code in sequence. Each receive() method is executed in a task and tasks can only run one at a time. The actual radio receive is done with interrupts, so you shouldn't miss anything unless you let your messages overrun your tasks.
On sending, the lower level does a "Carrier Detect" and "MAC backoff" to make sure the radio channel is free before sending. This doesn't entirely eliminate collisions but it's pretty good. If you still have issues with timer resetting, you'll need to use one or more state-variables, or build a queue mechanism, to keep track of what's what. MS Dymios wrote: > Subject: > AMReceiverC and buffering > From: > Dymios <dym...@soloingegneria.com> > Date: > Thu, 13 May 2010 22:17:23 +0200 > To: > tinyos-help@millennium.berkeley.edu > > To: > tinyos-help@millennium.berkeley.edu > > > Hi everybody, > I'm new to this mailing list. I'm working on a TinyOS project about > probabilistic broadcasting in a wireless sensor network. I'm going to do > some simulations with TOSSIM for plotting some graphs. > > I've a doubt about the AMReceiverC component. I understood that, when a > packet arrives, the function "receive" in my code will be called. > What happen if two packets arrive at the same time, or a new packet > arrives when I'm still executing the "receive" function for the previous > packet?? > > Another problem: before relying a packet to my neighbors, I would like > to let my nodes wait for a random time, in order to reduce the > probability of a collision. If I do this using a TimerMilliC component, > there will be a period of time during which If a new packet arrives, I > will re-set the timer, forgetting the previous packet... How can I wait > for a while without having this risk? > > Thanks > Dymios > > > ------------------------------------------------------------------------ > > _______________________________________________ > Tinyos-help mailing list > Tinyos-help@millennium.berkeley.edu > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help