vTaskDelete() of a Static Task

Can I assume that vTaskDelete() can be called on a static task? It seems reasonable that vTaskDelete() would simply modify the TCB so that the task is no longer scheduled (i.e. terminated), since there is no heap memory to be reclaimed. If true, perhaps a note in the fine Reference Manual would be nice.

Further, I assume that the termination would be immediate, even when a static task deletes itself.

Thanks, Warren

Yes, you can delete a statically allocated task in the same way you can a dynamically allocated task.

If a dynamically allocated task deletes itself then the memory allocated to hold the task’s stack and TCB are not freed immediately, but instead freed by the Idle task. If a statically allocated task deletes itself then there is nothing to be freed.

Thanks for confirming (it saves me from trudging through the code). The RM is pretty clear about dynamic allocated tasks but left me wondering about statically allocated ones.

1 Like