Bird
0
0

What is wrong with this deferred interrupt processing approach?

medium📝 Debug Q7 of 15
FreeRTOS - Interrupt Management
What is wrong with this deferred interrupt processing approach?
void ISR_Handler(void) {
  xSemaphoreGiveFromISR(&sem, NULL);
}
Assuming sem is a binary semaphore.
ASemaphore must be given before ISR starts
BxSemaphoreGiveFromISR cannot be called from ISR
CBinary semaphores cannot be used for deferred processing
DPassing NULL instead of BaseType_t* for xHigherPriorityTaskWoken is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Check xSemaphoreGiveFromISR parameters

    Second parameter must be a pointer to BaseType_t variable to detect if yield needed.
  2. Step 2: Why NULL is wrong

    Passing NULL disables context switch request, possibly delaying higher priority task.
  3. Final Answer:

    Passing NULL instead of BaseType_t* for xHigherPriorityTaskWoken is incorrect -> Option D
  4. Quick Check:

    Always pass BaseType_t* to FromISR APIs [OK]
Quick Trick: Always provide BaseType_t* to FromISR functions [OK]
Common Mistakes:
  • Passing NULL instead of valid pointer
  • Thinking semaphores can't be used in ISRs
  • Misusing semaphore timing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes