Bird
0
0

Why is it important to set a task handle to NULL after calling vTaskDelete() on it?

hard📝 Conceptual Q10 of 15
FreeRTOS - Task Creation and Management
Why is it important to set a task handle to NULL after calling vTaskDelete() on it?
ATo suspend the scheduler temporarily.
BTo avoid using an invalid handle that can cause system crashes.
CTo increase the priority of other tasks.
DTo automatically recreate the task later.
Step-by-Step Solution
Solution:
  1. Step 1: Understand handle validity after deletion

    After vTaskDelete, the task handle becomes invalid and should not be used.
  2. Step 2: Importance of setting handle to NULL

    Setting the handle to NULL prevents accidental use of an invalid pointer, avoiding crashes.
  3. Final Answer:

    To avoid using an invalid handle that can cause system crashes. -> Option B
  4. Quick Check:

    Nullify handle after delete to prevent crashes [OK]
Quick Trick: Set deleted task handles to NULL to avoid crashes [OK]
Common Mistakes:
  • Thinking NULL triggers task recreation
  • Confusing handle null with priority changes
  • Assuming it suspends scheduler

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes