fix(freertos): Fixed priority inversion when setting event group bits

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.
This commit is contained in:
Sudeep Mohanty 2024-10-01 15:35:37 +02:00
parent 632e0c2a9f
commit b013c1da82

View File

@ -4199,10 +4199,19 @@ void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem,
if( prvCheckForYield( pxUnblockedTCB, xCurCoreID, pdFALSE ) )
{
/* 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 */
}
}
/*-----------------------------------------------------------*/