Any sort of waiting is a bad idea in TOS because it is
non-pre-emptive. There is a threads implementation, of
which I know nothing, that might provide sync primitives
if you insist on doing it the way you describe.
However the pattern you probably want is fairly standard:
task1()
{
someMessage.send()
}
someMessage.sendDone()
{
// did it go out ok?
}
mymessage.receive()
{
post task2();
}
task2()
{
// continue from here
}
Hopefully you can interpret my shorthand sketch....
MS
ehsan enayati wrote:
> Hi, i'm doing my thesis simulations in tinyos2.1 and TOSSIM, in one of
> my component i need to wait for an event(general concept of event not
> the one in tinyos) to happen
> , i broadcast a packet via AMSend and i should wait till first response
> comes back and then continue my program sth like this:
> .
> .
> AMSend.send()
> WAIT and after receiving first response continue from here
> .
> .
> .
>
> i wanted to use semaphore but it didn't worked in TOSSIM, please help
> me my thesis deadline is near and i should solve this problem as soon as
> possible.
>
> ------------------------
> With the best regards
> *Ehsan Enayati*
> M.Sc. Student ,Information Technology
> Sharif University Of Technology
> [email protected] <mailto:[email protected]>
> http://ce.sharif.edu/~enayati
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help