Understanding RTOS queues
Queues are quite simple in concept, but they are also extremely powerful and flexible, especially if you’ve traditionally programmed on bare metal with C. At its heart, a queue is simply a circular buffer. However, this buffer contains some very special properties, such as native multi-thread safety, the flexibility for each queue to hold any type of data, and waking up other tasks that are waiting on an item to appear in the queue. By default, data is stored in queues using First In First Out (FIFO) ordering – the first item to be put into the queue is the first item to be removed from the queue.
We’ll start by looking at some simple behavior of queues when they are in different states and used in different ways (sending versus receiving), and then move on to how queues can be used to pass information between tasks.
Simple queue: sending an item
The first queue example is simply adding (also referred to as sending) an item...