Skip to content

Commit 28387df

Browse files
authored
Not yield for running task in prvYieldForTask (#72)
* Raise priority of a running task should not alter other cores
1 parent 14cec43 commit 28387df

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

tasks.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,10 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
798798
/* No task should yield for this one if it is a lower priority
799799
* than priority level of currently ready tasks. */
800800
if( pxTCB->uxPriority >= uxTopReadyPriority )
801+
#else
802+
803+
/* Yield is not required for a task which is already running. */
804+
if( taskTASK_IS_RUNNING( pxTCB ) == pdFALSE )
801805
#endif
802806
{
803807
xLowestPriorityToPreempt = ( BaseType_t ) pxTCB->uxPriority;
@@ -818,24 +822,29 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
818822

819823
if( ( taskTASK_IS_RUNNING( pxCurrentTCBs[ xCoreID ] ) != pdFALSE ) && ( xYieldPendings[ xCoreID ] == pdFALSE ) )
820824
{
821-
if( xCurrentCoreTaskPriority <= xLowestPriorityToPreempt )
825+
#if ( configRUN_MULTIPLE_PRIORITIES == 0 )
826+
if( taskTASK_IS_RUNNING( pxTCB ) == pdFALSE )
827+
#endif
822828
{
823-
#if ( configUSE_CORE_AFFINITY == 1 )
824-
if( ( pxTCB->uxCoreAffinityMask & ( 1 << xCoreID ) ) != 0 )
825-
#endif
829+
if( xCurrentCoreTaskPriority <= xLowestPriorityToPreempt )
826830
{
827-
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
828-
if( pxCurrentTCBs[ xCoreID ]->xPreemptionDisable == pdFALSE )
831+
#if ( configUSE_CORE_AFFINITY == 1 )
832+
if( ( pxTCB->uxCoreAffinityMask & ( 1 << xCoreID ) ) != 0 )
829833
#endif
830834
{
831-
xLowestPriorityToPreempt = xCurrentCoreTaskPriority;
832-
xLowestPriorityCore = xCoreID;
835+
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
836+
if( pxCurrentTCBs[ xCoreID ]->xPreemptionDisable == pdFALSE )
837+
#endif
838+
{
839+
xLowestPriorityToPreempt = xCurrentCoreTaskPriority;
840+
xLowestPriorityCore = xCoreID;
841+
}
833842
}
834843
}
835-
}
836-
else
837-
{
838-
mtCOVERAGE_TEST_MARKER();
844+
else
845+
{
846+
mtCOVERAGE_TEST_MARKER();
847+
}
839848
}
840849

841850
#if ( configRUN_MULTIPLE_PRIORITIES == 0 )

0 commit comments

Comments
 (0)