[Tinyos-devel] Packet.clear()
Philip Levis
pal at cs.stanford.edu
Wed Oct 17 13:34:22 PDT 2007
On Oct 17, 2007, at 11:04 AM, David Gay wrote:
> On 10/17/07, Miklos Maroti <mmaroti at math.u-szeged.hu> wrote:
>> If the message to be sent is statically allocated in a component and
>> its ownership does not change (other than passing via Send.send),
>> then
>> Packet.clear need not be called. In this case ALL metadata used for
>> transmission MUST NOT be changed by the Send implementation.
>
> Presumablt this exception should be extended to only returning it via
> Receive.receive.
>
> And in both cases it should be clear that this only applies to "things
> going to the same comm stack", i.e., if you have 2 Send's, then you
> must use clear if you don't know that they go the same stack.
> Hopefully you should be able to switch between Receive and Send for
> the same comm stack...
This came up on the call briefly. I don't think that you can ever
safely say that you can switch between Receive and Send, because the
wiring of those two is outside your control. For example, it's
entirely possible to take CtpForwardingEngineP and hook its receive
up to the serial stack while its transmit is up to the radio stack.
Furthermore, this puts the onus on the receive side to clear out
these fields. Otherwise, they will be as they were the last time send
was called with that buffer, which might not have been this same
component. In that way, Receive by itself is not sufficient, because
it's possible you returned it to a queue, which then another
component uses for Receive.
I'm not sure what the exact correct usage should be.
Phil
More information about the Tinyos-devel
mailing list