Passing User Interface events to worker Tasks

I have a User Interface task which has a myDevice struct variable storing all values which represent the device. When the user presses buttons or turns knobs, I plan on having the User Interface tasks add these as ‘events’ to a queue. Other tasks can then watch the queue for User Interface events and take action or change their state.

I have 3 Worker Tasks which all need access to the User Interface events.

Should I create 3 separate queues, 1 for each of the 3 worker tasks and send the user interface events to each queue? If I create only 1 user interface queue and all 3 tasks watch the queue, which tasks deletes the item from the queue?

Thank you!

If there is only one queue then the highest priority task that was blocked on the queue waiting for data is the task that will receive the data. If the tasks have the same priority, then it is the task that has been blocked on the queue the longest that receives the data.

Could you have all the user interface events processed in the same task, rather than having three tasks?

Please do not double post !
This more or less repeats your previous post Sending User Interface Events to multiple Tasks

Ok thanks. The worker tasks would all have the same priority. I was looking to have a Controller Task which would receive queue commands from the User Interface tasks but not sure how to pass the queued ‘state change commands’ from the Controller task to the 3 worker tasks. Just trying to get my head around it as this is my first app.

I’ll always make sure there is only 1 primary task accepting events from the User Interface task, and will have the primary task send queue messages to the other 2 tasks as ‘child tasks’. I still end up with 3 queues, but I can make each queue size different and specific for each task. I may even try to combine the 3 worker tasks into 1 since they are all the same priority.