Nehal
DIIDevHeads IoT Integration Server
•Created by Enthernet Code on 5/21/2024 in #middleware-and-os
Implementing Task Synchronization in RTOS for Sensor Data Processing and Display
Semaphore or mutex can be a good option but you can also create an enum for states (if task B is dependent on task A to get the data) .
Let's say you create an enum with Task A, B and None.
None means both tasks can acquire it. When you have the data in task A make the enum to A so that task B when checks the enum it gets task A and doesn't perform anything. After you are done with task A change the enum to task B so when task B checks it performs its operation and in the end change the state to again for Task A.
In this way task B is dependent on task A. Also keep in mind use mutex to read and write the enum to avoid race conditions.
10 replies