Bird
0
0

Given this FreeRTOS code snippet, what is the main issue?

medium📝 Debug Q14 of 15
FreeRTOS - Task Notifications
Given this FreeRTOS code snippet, what is the main issue?
uint32_t notifyValue;
if (xTaskNotifyWait(0, 0xFFFFFFFF, ¬ifyValue, portMAX_DELAY) == pdTRUE) {
    // Process notification
    process(notifyValue);
}
// Later
xQueueSend(queueHandle, &data, 0);
AxQueueSend is called without checking if the queue is full.
BxTaskNotifyWait cannot be used with queues.
CnotifyValue is not initialized before use.
DUsing portMAX_DELAY in xTaskNotifyWait can cause indefinite blocking.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze xTaskNotifyWait usage

    Using portMAX_DELAY causes the task to block indefinitely until a notification arrives.
  2. Step 2: Consider implications

    This indefinite block can cause deadlocks if notifications are not sent, which is a common issue.
  3. Final Answer:

    Using portMAX_DELAY in xTaskNotifyWait can cause indefinite blocking. -> Option D
  4. Quick Check:

    portMAX_DELAY = indefinite block risk [OK]
Quick Trick: portMAX_DELAY blocks forever; use timeout carefully [OK]
Common Mistakes:
  • Ignoring blocking behavior of portMAX_DELAY
  • Assuming notifyValue must be initialized
  • Confusing queue and notification usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes