Hi Michael Sorry, I missed some background introduction.
Actually, the endPacket() event is signaled as the incoming byte stream is end. However, before the byte stream starts, the event ReceiveBytePacket.startPacket() should be signaled, in this event, there is an operation to lock the current buffer. Current buffer is always switched to each other in the event endPacket() (Here, the condition should be fulfilled). For example, if the current buffer is buffer 0, then in the endPacket(), the current buffer is switched to Buffer 1. Suppose the incoming byte stream is entering into the buffer 1, first buf 1 is locked, then buffer 1 can receive the stream smoothly. Once this byte stream is end, then endPacket() should be signaled, what I really wanna express is that if the condition judgment fails, then there is no further buffer swapping, and the locking status of current buffer will not change. Going back to the example, although the byte stream is end, due to the failure of condition judgment, the current buffer is still buffer 1, which is still locked. In this case, the subsequent byte stream will not be received any more by buffer 1, since it is locked. Moreover, the buffer 0 will never take the chance to receive any byte, since there will never be buffer swapping either. Regards Peng Michael Schippling wrote: > Sorry, I'm lost...where is a "current buffer" and how is it {un}locked? > MS > > peter...@cs.utah.edu wrote: >> Hi There >> >> In my stressing test, I also found another problem, which is the event >> ReceiveBytePacket.endPacket(error_t result) in SerialDispatcherP.nc >> component >> >> async event void ReceiveBytePacket.endPacket(error_t result) { >> uint8_t postsignalreceive = FALSE; >> atomic { >> if (!receiveTaskPending && result == SUCCESS) { >> /***** I evict the concrete code here *****/ >> } >> } >> if (postsignalreceive){ >> post receiveTask(); >> } >> } >> >> Generally, this event is signaled once the transmission of byte >> stream on the receive >> path is finished. If the condition flags within the atomic section >> are fulfilled, then >> everything is fine... >> >> However, if these flags can't be met, based on current design, there >> is no further >> handling. Note that the current buffer is still locked, and there is >> no buffer swapping >> either. In other words, if new byte stream comes in, then it will >> still try to enter this >> locked buffer, resulting in the deadlock. >> >> Is my analysis correct? Thanks a lot for your clarification! >> >> Regards >> >> Peng >> >> ---------------------------------------------------------------- >> This message was sent using IMP, the Internet Messaging Program. >> >> _______________________________________________ >> 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