Bird
0
0

Identify the issue in the following FreeRTOS code snippet using xTaskNotifyGive():

medium📝 Debug Q6 of 15
FreeRTOS - Task Notifications
Identify the issue in the following FreeRTOS code snippet using xTaskNotifyGive():
void Task1(void *pvParameters) {
    ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
}

void Task2(void *pvParameters) {
    xTaskNotifyGive();
}
AulTaskNotifyTake() is used incorrectly with pdTRUE parameter.
BxTaskNotifyGive() is called without specifying the task handle to notify.
CTask1 should not block indefinitely with portMAX_DELAY.
DTask2 should call ulTaskNotifyTake() instead of xTaskNotifyGive().
Step-by-Step Solution
Solution:
  1. Step 1: Check xTaskNotifyGive() usage

    This function requires a TaskHandle_t parameter to specify which task to notify.
  2. Step 2: Analyze the code

    Task2 calls xTaskNotifyGive() without any argument, which is invalid.
  3. Final Answer:

    xTaskNotifyGive() is called without specifying the task handle to notify. -> Option B
  4. Quick Check:

    Missing task handle parameter [OK]
Quick Trick: xTaskNotifyGive needs task handle argument [OK]
Common Mistakes:
  • Omitting task handle parameter
  • Misusing ulTaskNotifyTake parameters
  • Confusing notify and wait functions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes