When an interrupt occurs, you must use special FreeRTOS API functions that are safe to call from interrupt context. These functions have the suffix FromISR. Inside the ISR, you declare a variable xHigherPriorityTaskWoken initialized to pdFALSE. When calling a FromISR function like xQueueSendFromISR, this variable may be set to pdTRUE if the operation wakes a higher priority task. After the call, you check xHigherPriorityTaskWoken and call portYIELD_FROM_ISR if it is true. This causes the scheduler to switch to the higher priority task immediately after the ISR finishes. If you do not call portYIELD_FROM_ISR, the higher priority task will wait until the next normal context switch. Normal FreeRTOS API functions are not safe to call inside ISRs because they may block or cause unsafe operations. Using FromISR APIs ensures safe and efficient interrupt handling in FreeRTOS.