From the course: Introduction to FreeRTOS and Basic Task Management

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Reading task priority

Reading task priority

- [Trainer] So let's see how to read the priority of a task in runtime. Before we do that, let's analyze what a project is currently doing. As we see over here from lines 48 and 49, the project creates two tasks and both of them have priority level two as we see over here. When we go to their task functions, we realize that task one, simply increments its task profiler. Task two, on the other hand, does a bit of work by counting from 1 to 100,000 increments its task profiler and then checks if the profiler is greater than 100. And if the profiler is greater than 100, task two update the priority level of the same task, task two to one. So it update its own priority level to one. Our job here is to read the priority level of task two from task one to see whether it changes. To do this, we first declare a variable to hold the priority level that we read. So I'll come up here to line 33 and declare uint32_t. I'll call this task2_priority. Task two priority. And then we use this, I'll…

Contents