Bird
0
0

What is wrong with this event-driven task code?

medium📝 Debug Q7 of 15
FreeRTOS - Design Patterns for RTOS
What is wrong with this event-driven task code?
void vTask(void *pvParameters) {
  EventGroupHandle_t xEventGroup = xEventGroupCreate();
  xEventGroupWaitBits(xEventGroup, 0x01, pdTRUE, pdFALSE, portMAX_DELAY);
}
AxEventGroupWaitBits() cannot be called with portMAX_DELAY
BThe task does not delete itself after waiting
CThe bit mask 0x01 is invalid
DThe event group is created inside the task and not shared
Step-by-Step Solution
Solution:
  1. Step 1: Analyze event group creation location

    The event group is created inside the task, so other tasks cannot share it.
  2. Step 2: Understand sharing requirement in event-driven design

    Event groups should be created outside tasks and shared for synchronization.
  3. Final Answer:

    The event group is created inside the task and not shared -> Option D
  4. Quick Check:

    Event groups must be shared for inter-task sync [OK]
Quick Trick: Create event groups outside tasks for sharing [OK]
Common Mistakes:
  • Creating event groups inside tasks
  • Misunderstanding portMAX_DELAY usage
  • Assuming bit mask 0x01 is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes