Skip to content

Commit

Permalink
Fix missed yield in xTaskResumeFromISR (#207)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
aggarg authored Oct 23, 2020
1 parent c6636f4 commit db62e30
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,11 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
{
xYieldRequired = pdTRUE;

/* Mark that a yield is pending in case the user is not
* using the return value to initiate a context switch
* from the ISR using portYIELD_FROM_ISR. */
xYieldPending = pdTRUE;
}
else
{
Expand Down

0 comments on commit db62e30

Please sign in to comment.