Skip to content

Commit

Permalink
fix(freertos): Fixed priority inversion when setting event group bits
Browse files Browse the repository at this point in the history
This commit fixes a priority inversion when a lower priority task set
event group bits to unblock a higher priority task but the lower
priority task continued to run.
  • Loading branch information
sudeep-mohanty committed Oct 8, 2024
1 parent 6dc8fe3 commit bd4de3c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions components/freertos/FreeRTOS-Kernel/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -4123,10 +4123,19 @@ void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
if( taskIS_YIELD_REQUIRED( pxUnblockedTCB, pdFALSE ) == pdTRUE )
{
/* The unblocked task has a priority above that of the calling task, so
* a context switch is required. This function is called with the
* scheduler suspended so xYieldPending is set so the context switch
* occurs immediately that the scheduler is resumed (unsuspended). */
xYieldPending[ xCurCoreID ] = pdTRUE;
* a context switch is required. */
#if ( configNUM_CORES > 1 )

/* In SMP mode, this function is called from a critical section, so we
* yield the current core to schedule the unblocked task. */
portYIELD_WITHIN_API();
#else /* configNUM_CORES > 1 */

/* In single-core mode, this function is called with the scheduler suspended
* so xYieldPending is set so the context switch occurs immediately once the
* scheduler is resumed (unsuspended). */
xYieldPending[ xCurCoreID ] = pdTRUE;
#endif /* configNUM_CORES > 1 */
}
}
}
Expand Down

0 comments on commit bd4de3c

Please sign in to comment.