Sure no problem. the taskq (which is what you are talking about in SchedulerBasicP) is actually very efficient. It doesn't use pointers but does use indexes. Pointers are generally a bad idea because they can easily get corrupted and then all hell breaks loose.
Lets say we have 10 potential tasks in the system there will be ten one byte entries in the queue. m_head and m_tail are also bytes. If the queue is empty, m_head == m_tail == 0xff. Lets say we have one task posted (task 6). Then m_head == 6, m_tail == 6, and m_queue[6] == 0xff. So now lets say we have 3 tasks that have been posted (6, 1, 8). The state will then be: m_head == 6, m_tail == 8 m_queue[6] == 1, m_queue[1] == 8, and m_queue[8] == 0xff. Now if you follow the code closely you will see that indeed it is a fifo. eric On Sat, Apr 30, 2011 at 9:36 AM, Xiaohui Liu <[email protected]> wrote: > Hi everyone, > > Can anyone help me understand how the FIFO queue works > in SchedulerBasicP? It seems different from implementation I have seen > before, in which m_head, m_tail point to head and tail of queue, > respectively. But m_head, m_tail in SchedulerBasicP don't seem to be such > pointers and there is no movement of them through self-increment > (e.g., m_head++). Thanks a lot. > > -- > -Xiaohui Liu > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > -- Eric B. Decker Senior (over 50 :-) Researcher
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
