From the course: Introduction to FreeRTOS and Basic Task Management

Unlock this course with a free trial

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

Deleting a task in FreeRTOS

Deleting a task in FreeRTOS

- [Instructor] Sometimes a task simply needs to do its job and then gets deleted so that we can reclaim the memory and other resources allocated to that task. In this lesson, we're going to see how to delete a task and we're going to use the same experimental approach we used in demonstrating how to suspend a task. So we're going to have a threshold and wait until the number of iterations crosses that threshold and then we'll delete the task. So let's start with to do item one here. At line nine, we would define the delete threshold. I'll say define and then I'll say delete thresh and I'll set it to 250 iterations. And also we would define the global variable, which we would call the delete monitor, to monitor when we've crossed the threshold. So at line 31, which is our to do item two over here, I'll have a uint32_t variable, which I'll call delete monitor. Once that is done, we go to the task function. We would use task one to delete task two, so we would go to task one. So we would…

Contents