I’m posting to share my recent findings. Under certain circumstances, a call to xQueueReceive() can leave interrupts disabled for an extensive period of time. I am running FreeRTOS on a C8051F120 from Silicon Labs. The processor is running at 100 MHz. Here is what I have observed:
If a queue changes from empty to not empty within xQueueReceive() between the return from to prvIsQueueEmpty() and the call to taskENTER_CRITICAL() a few lines later, the resultant critical section lasts for 140 us instead of the normal 11 us.
I made these measurements by setting a pin high just after the taskENTER_CRITICAL() call and clearing the pin just before the calls to taskYIELD() in both xQueueReceive() and xTaskResumeAll().