Skip to content

Commit db62e30

Browse files
authored
Fix missed yield in xTaskResumeFromISR (#207)
If a higher priority task than the currently running task was resumed using xTaskResumeFromISR and the user chose to ignore the return value of xTaskResumeFromISR to initiate a context switch using portYIELD_FROM_ISR, we were not doing the context switch on the next run of the scheduler. This change fixes this by marking a yield as pending to ensure that the context switch is performed on the next run of the scheduler. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
1 parent c6636f4 commit db62e30

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tasks.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,11 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
19491949
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
19501950
{
19511951
xYieldRequired = pdTRUE;
1952+
1953+
/* Mark that a yield is pending in case the user is not
1954+
* using the return value to initiate a context switch
1955+
* from the ISR using portYIELD_FROM_ISR. */
1956+
xYieldPending = pdTRUE;
19521957
}
19531958
else
19541959
{

0 commit comments

Comments
 (0)