Thank you for your quick response.

You are right. I have tried the task in sendDone version to avoid calling send in sendDone. As for breaking the functionTest() in many tasks, I will try it. Though it is still strange as Msg2.send is called after functionTest() finishes. functionTest() is supposed to just delay the call of Msg2.send, which it does, but how can it influence it's succees or not?
Anyway, I will try it to see how it goes.

PK



----- Original Message ----- From: "Michael Schippling" <[EMAIL PROTECTED]>
To: "Panos Kampanakis" <[EMAIL PROTECTED]>
Cc: <tinyos-help@Millennium.Berkeley.EDU>
Sent: Friday, February 23, 2007 5:12 PM
Subject: Re: [Tinyos-help] Msg.send always fails


well, there's probably lots of stuff going on in the background
that doesn't get to run while your functionTest() hogs the controller.
I wouldn't hazard a guess as to exactly what is getting hung up,
but the best TOS approach would be to break your function into
multiple tasks that post each other in sequence so the rest of the
background can get a processor slice once in a while.

And in general, it's a bad idea to call something like send()
from within sendDone() because it's executing in an "event"
context, which is like, or even really, an interrupt. So breaking
it out into a separate task is a GoodIdea(TM) anyway.

MS

Panos Kampanakis wrote:
Hi,
I have the following code in TinyOS:

event result_t Msg1.sendDone(TOS_MsgPtr sent, result_t success) {
    call TP.functionTest(); // takes 10 secs
    call Msg2.send(TOS_UART_ADDR, sizeof(tp_time_msg), &report);
   return SUCCESS;
 }

When I am trying to send a message after the call function functionTest() it always fails. The functionTest() takes 10 seconds to finish, but it finishes. The Msg2.send always fails but the code reaches its point. It just fails. If I change the functionTest() to take less time the Msg2.send secceeds. There are no other interrupts of race conditions in my program.
Any logical explanentions? It doesn't make sense.

PK


_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to