Skip to content

Commit bb6071e

Browse files
authored
Update equal priority task preemption (#603)
* vTaskResume and vTaskPrioritySet don't preempt equal priority task * Update vTaskResumeAll not to preempt task with equal priority * Fix in xTaskResumeFromISR
1 parent 6d65558 commit bb6071e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tasks.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
15521552
/* The priority of a task other than the currently
15531553
* running task is being raised. Is the priority being
15541554
* raised above that of the running task? */
1555-
if( uxNewPriority >= pxCurrentTCB->uxPriority )
1555+
if( uxNewPriority > pxCurrentTCB->uxPriority )
15561556
{
15571557
xYieldRequired = pdTRUE;
15581558
}
@@ -1845,7 +1845,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
18451845
prvAddTaskToReadyList( pxTCB );
18461846

18471847
/* A higher priority task may have just been resumed. */
1848-
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
1848+
if( pxTCB->uxPriority > pxCurrentTCB->uxPriority )
18491849
{
18501850
/* This yield may not cause the task just resumed to run,
18511851
* but will leave the lists in the correct state for the
@@ -1913,7 +1913,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
19131913
{
19141914
/* Ready lists can be accessed so move the task from the
19151915
* suspended list to the ready list directly. */
1916-
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
1916+
if( pxTCB->uxPriority > pxCurrentTCB->uxPriority )
19171917
{
19181918
xYieldRequired = pdTRUE;
19191919

@@ -2203,9 +2203,9 @@ BaseType_t xTaskResumeAll( void )
22032203
listREMOVE_ITEM( &( pxTCB->xStateListItem ) );
22042204
prvAddTaskToReadyList( pxTCB );
22052205

2206-
/* If the moved task has a priority higher than or equal to
2207-
* the current task then a yield must be performed. */
2208-
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
2206+
/* If the moved task has a priority higher than the current
2207+
* task then a yield must be performed. */
2208+
if( pxTCB->uxPriority > pxCurrentTCB->uxPriority )
22092209
{
22102210
xYieldPending = pdTRUE;
22112211
}

0 commit comments

Comments
 (0)