Skip to content

Commit

Permalink
Remove unnecessary loop in xTaskIncrementTick for single core
Browse files Browse the repository at this point in the history
  • Loading branch information
chinglee-iot committed Nov 10, 2022
1 parent de64fa7 commit 3df1ad7
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3978,10 +3978,10 @@ BaseType_t xTaskIncrementTick( void )
TickType_t xItemValue;
BaseType_t xSwitchRequired = pdFALSE;

#if ( configUSE_PREEMPTION == 1 )
#if ( configUSE_PREEMPTION == 1 ) && ( configNUM_CORES > 1 )
UBaseType_t x;
BaseType_t xYieldRequiredForCore[ configNUM_CORES ] = { pdFALSE };
#endif /* #if ( configUSE_PREEMPTION == 1 ) */
#endif /* #if ( configUSE_PREEMPTION == 1 ) && ( configNUM_CORES > 1 ) */

#if ( configNUM_CORES > 1 )
taskENTER_CRITICAL();
Expand Down Expand Up @@ -4156,22 +4156,10 @@ BaseType_t xTaskIncrementTick( void )

#if ( configUSE_PREEMPTION == 1 )
{
for( x = ( UBaseType_t ) 0; x < ( UBaseType_t ) configNUM_CORES; x++ )
{
if( xYieldPendings[ x ] != pdFALSE )
{
xYieldRequiredForCore[ x ] = pdTRUE;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}

#if ( configNUM_CORES == 1 )
{
/* For single core the core ID is always 0. */
if( xYieldRequiredForCore[ 0 ] != pdFALSE )
if( xYieldPendings[ 0 ] != pdFALSE )
{
xSwitchRequired = pdTRUE;
}
Expand All @@ -4191,7 +4179,7 @@ BaseType_t xTaskIncrementTick( void )
if( pxCurrentTCBs[ x ]->xPreemptionDisable == pdFALSE )
#endif
{
if( xYieldRequiredForCore[ x ] != pdFALSE )
if( ( xYieldRequiredForCore[ x ] != pdFALSE ) || ( xYieldPendings[ x ] != pdFALSE ) )
{
if( x == ( UBaseType_t ) xCoreID )
{
Expand Down

0 comments on commit 3df1ad7

Please sign in to comment.