Sharing a linked list
Posted: Tue Nov 23, 2010 7:26 am
Hi all,
I have an application with a number of tasks and 1 of the tasks is setup to handle the touch screen and dislay the graphics. One of the other tasks handles a wireless communications link.
The wireless task simply sends out requests to another device that sends back resonses. The task has a simple state machine that is used to keep track of what commands are being sent. When idle and no queued messages to send, it simply sends sensor data to the remote.
This wireless task also needs to send out different requests based on what the user has done via the touch screen so I have setup a linked list that gets populated with the commands and I need a way for the wireless task to check this linked list to see if it is ready to process new commands and once processed, it simply deletes this entry from the list.
The list not going to be big and probably no more than about 10-20 commands at any one time (one input on the touch screen generates 10 or more commands to request job data from the remote).
I had thought about a fixed array for this but this means I need to know the max commands at any one time.
The question I have regardless of what method I use for the list, is how to pass this information between tasks. The wireless task has to loop endlessly so there can be no pending for flags etc. I am looking at FIFO and QUEUE as 2 of the options and wondering if anyone has recommendations for the best way to handle this across tasks and which of these is the ideal way forward?
Thanks
Dave...
I have an application with a number of tasks and 1 of the tasks is setup to handle the touch screen and dislay the graphics. One of the other tasks handles a wireless communications link.
The wireless task simply sends out requests to another device that sends back resonses. The task has a simple state machine that is used to keep track of what commands are being sent. When idle and no queued messages to send, it simply sends sensor data to the remote.
This wireless task also needs to send out different requests based on what the user has done via the touch screen so I have setup a linked list that gets populated with the commands and I need a way for the wireless task to check this linked list to see if it is ready to process new commands and once processed, it simply deletes this entry from the list.
The list not going to be big and probably no more than about 10-20 commands at any one time (one input on the touch screen generates 10 or more commands to request job data from the remote).
I had thought about a fixed array for this but this means I need to know the max commands at any one time.
The question I have regardless of what method I use for the list, is how to pass this information between tasks. The wireless task has to loop endlessly so there can be no pending for flags etc. I am looking at FIFO and QUEUE as 2 of the options and wondering if anyone has recommendations for the best way to handle this across tasks and which of these is the ideal way forward?
Thanks
Dave...