Bird
0
0

Identify the problem in this FreeRTOS ISR notification code snippet:

medium📝 Debug Q6 of 15
FreeRTOS - Task Notifications
Identify the problem in this FreeRTOS ISR notification code snippet:
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xTaskNotifyFromISR(taskHandle, 0x01, eSetBits, &xHigherPriorityTaskWoken);
if (xHigherPriorityTaskWoken) {
    vTaskDelay(10);
}
ACalling vTaskDelay() inside an ISR
BNot checking return value of xTaskNotifyFromISR
CUsing eSetBits instead of eIncrement
DNot clearing notification bits before wait
Step-by-Step Solution
Solution:
  1. Step 1: Understand ISR constraints

    Inside an ISR, blocking or delaying functions like vTaskDelay() must not be called.
  2. Step 2: Analyze the code

    The code calls vTaskDelay(10) inside the ISR if a higher priority task was woken, which is invalid.
  3. Final Answer:

    Calling vTaskDelay() inside an ISR -> Option A
  4. Quick Check:

    Delays not allowed in ISR context [OK]
Quick Trick: Never call vTaskDelay inside ISR [OK]
Common Mistakes:
  • Calling blocking APIs inside ISR
  • Ignoring xHigherPriorityTaskWoken flag
  • Misusing notification action parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes