Task Message Queue
It is fairly rare to find applications where multiple tasks wait on a single message queue. Because of this, a message queue is built into each task and the user can send messages directly to a task without going through an external message queue object. This feature not only simplifies the code but, is also more efficient than using a separate message queue object. The message queue that is built into each task is shown in the figure below.
Task message queue services in µC/OS-III start with the OSTaskQ???()
prefix, and services available to the application programmer are described in µC/OS-III API Reference. Setting OS_CFG_TASK_Q_EN
to DEF_ENABLED
in os_cfg.h
enables task message queue services. The code for task message queue management is found in os_task.c
.
You use this feature if the code knows which task to send the message(s) to. For example, if receiving an interrupt from an Ethernet controller, you can send the address of the received packet to the task that will be responsible for processing the received packet.