Are Queues safe for multiple senders?

atiflz wrote on Tuesday, September 08, 2015:

I am implementing an architecture where multiple tasks generate data, send it to one CAN task that will aggregate all incoming data and send them through CAN bus. Is using one queue for all the tasks is safe or should I find another solution like multiple queues or mutex?

richard_damon wrote on Tuesday, September 08, 2015:

Multiple tasks sending to a queue is perfectly safe, and much easier than trying to get the receiving task to accept data on multiple queues.

The one thing you can’t do is give the sending tasks priority, so you process messages from the highest priority task first, but you can put high priority messages on the front of the queue and low priority messages on the back (if you fall behind this might cause the high priority messages to change order).