Updated Jul 2025
xTaskResumeFromISR()
task. h
1BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume );
INCLUDE_vTaskSuspend
INCLUDE_xTaskResumeFromISR
A function to resume a suspended task that can be called from within an ISR.
A task that has been suspended by one of more calls to
vTaskSuspend()
xTaskResumeFromISR()
xTaskResumeFromISR()
Parameters:
-
xTaskToResume
Handle to the task being readied.
Returns:
- pdTRUE if resuming the task should result in a context switch,
- pdFALSE otherwise. This is used by the ISR to determine if a context switch may be required following the ISR.
Example usage:
1TaskHandle_t xHandle;23void vAFunction( void )4{5 // Create a task, storing the handle.6 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );78 // ... Rest of code.9}1011void vTaskCode( void *pvParameters )12{13 // The task being suspended and resumed.14 for( ;; )15 {16 // ... Perform some function here.1718 // The task suspends itself.19 vTaskSuspend( NULL );2021 // The task is now suspended, so will not reach here until the ISR resumes it.22 }23}2425void vAnExampleISR( void )26{27 BaseType_t xYieldRequired;2829 // Resume the suspended task.30 xYieldRequired = xTaskResumeFromISR( xHandle );3132 // We should switch context so the ISR returns to a different task.33 // NOTE: How this is done depends on the port you are using. Check34 // the documentation and examples for your port.35 portYIELD_FROM_ISR( xYieldRequired );36}