Hi all,
As Hui I don't understand the difference between async and sync...
If the the answer is like Cory says, there is no difference between sync and async command, perhaps only the fact that the compiler reports possible data races in the command was delcare sync. Is right?
About events.. I have seen that if a event was delcared sync, when it is signaled and there's a current operation running, the event was ignored. Instead, if the event was declared async, the current operation is stopped and the control pass to the procedure implemented by the component that use that interface. Is right?
Thanks to all!
Cristian
KANG HUI <[EMAIL PROTECTED]> ha scritto:
Hi, Cory,
Thank you for you reply.
But on the mailing list, most of them deal with interrupt and event
handler. When I concern about is the command function and task.
If as you said command function is like C function and returns
immediately, why does nesC need "asyn command"? Asynchrous command
function executes immediately and preempt tasks.
Is command function without "asyn" like task will be deferred for some
time. For example,
(1)Non asyn command function
In component A, it call B.process(), which isn't defiedn as a asyn
command. Then B. process() will be put into the task queue and executed
later.
(2) asyn command function
Component A call B.process(), which is asyn command. Then B.process()
execute immediately and preempt other tasks in the task queue.
So my conclusion is that command function without "asyn" is like task,
insead of C-function.
Hui
On Tue, 26 Sep 2006, Cory Sharp wrote:
> Kang,
>
> Please search the TinyOS Help archives. It seems like we discuss this at
> length at least once a month. A handy form for search ing is here:
>
> http://www.moteiv.com/community/TinyOS_Information
>
> Short answer: commands and events are just like C functions, they're not
> tasks.
>
> Cory
>
> On 9/26/06, KANG HUI <[EMAIL PROTECTED]>wrote:
> >
> > Dr. Levis:
> > If a command has the following code
> >
> > command result_t A.p(){
> > ...
> > post TaskB();
> > ...
> > }
> > If some module call A.p(), the execution sequence is : first A.p() is
> > put into the task queue and runs to
> > completion, and then TaskB will be executed until a later time. And the
> > return value of A.p() is whether TaskB be put into the task queue.
> > So command and event function is also two kinds of tasks. But a C-like
> > function such as
> > void f(){
> > }
> > is not a task and will return immediately.
> > Is my understanding right? Please correct me. Thanks.
> >
> > Regards,
> > Hui
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Yahoo! Mail: gratis 1GB per i messaggi, antispam, antivirus, POP3
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
