Dr. Levis: There is some question I still can not understand fully.
>> 2: Second, to prove there exists a call loop, you modify >> Read.readDone as >> in pp 32. >> Herein, it calls Read.read() in Read.readDone(). I agree that in this >> example >> call loop occurs. >> So the modified code in pp 33 post task void readDoneTask() to >> avoid the >> call loop. >> Two problems in this code example: >> (a) In this example, RawRead.readDone (should it be Read.readDone() ) >> actually does not call Read.read(). If the answer to 1 is yes, >> then it seems >> no improvement by using task. Both have the same effect. The the code >> example in >> pp 33 is not suitable to show the benefit of Task. > >Take a look at the code on page 34. The question is not whether the >provider of Read calls Read.read in Read.readDone, but whether the >*user* does. Please look at listing 4.12, entitled "Signal handler >that can lead to an infinite loop." > Yes, but in the code example in Listing 4.15( An improved implementation of PeriodicReaderC ), the PeriodicReaderC is the user of Read. It does not call Read.read(). So even we don't use task, call loop will not occur. So it is not suitable to show the benefit of task. >> >> (b) If assuming that the code example in 33 posted Read.read() in >> RawRead.readDone, >> does task avoid the call loop? As said, task can run atomicly to other >> tasks. But >> it is possible that Read.read() preempt to the task. So the call loop >> still exists? >> > >No. Look at the next listing. > I know that task can not preempt each other. Then can Read.read(), or other sync commands and events preempt to any task? > >> 3: What is the difference between task and an ordinary function, like >> task void ProcessData() and void ProcessData(); >> I am a little bit confused. Thanks. > >A function executes immediately. A task executes later. > >Phil > >_______________________________________________ >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
