Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to delete the current FreeRTOS task.
FreeRTOS
void TaskFunction(void *pvParameters) {
// Task code here
[1](NULL); // Delete this task
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using xTaskCreate instead of vTaskDelete.
Trying to suspend the task instead of deleting it.
✗ Incorrect
The function vTaskDelete(NULL) deletes the currently running task.
2fill in blank
mediumComplete the code to delete a task using its handle.
FreeRTOS
TaskHandle_t xHandle = NULL;
// Task creation code here
[1](xHandle); // Delete the task using its handle Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using xTaskCreate instead of vTaskDelete.
Trying to suspend or resume the task instead of deleting.
✗ Incorrect
Use vTaskDelete(xHandle) to delete a task by its handle.
3fill in blank
hardFix the error in the code to properly delete the task.
FreeRTOS
void TaskFunction(void *pvParameters) {
// Task code
[1](NULL); // Incorrect deletion
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'xTaskDelete' which does not exist.
Confusing suspend and delete functions.
✗ Incorrect
The correct function to delete a task is vTaskDelete(), not xTaskDelete().
4fill in blank
hardFill both blanks to create and then delete a task properly.
FreeRTOS
TaskHandle_t xTaskHandle = NULL; [1](TaskFunction, "Task", 1000, NULL, 1, &xTaskHandle); [2](xTaskHandle);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using vTaskDelete before creating the task.
Using suspend instead of delete.
✗ Incorrect
First, create the task with xTaskCreate(), then delete it with vTaskDelete().
5fill in blank
hardFill all three blanks to create a task, delete it, and then start the scheduler.
FreeRTOS
TaskHandle_t xHandle = NULL; [1](TaskFunction, "Task", 512, NULL, 2, &xHandle); [2](xHandle); [3]();
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Starting scheduler before creating tasks.
Deleting task before creating it.
Using suspend instead of delete.
✗ Incorrect
Create the task with xTaskCreate(), delete it with vTaskDelete(), then start the scheduler with vTaskStartScheduler().