From 7372519cba39922ce5aeb92b8931cf8694b78bd2 Mon Sep 17 00:00:00 2001 From: Moral-Hao Date: Sat, 19 Aug 2023 00:05:10 +0800 Subject: [PATCH] Use the bigger priority whenever possible. (#760) Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> --- tasks.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks.c b/tasks.c index 0f865ef4a..2786c5ab0 100644 --- a/tasks.c +++ b/tasks.c @@ -2462,8 +2462,9 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, #if ( configUSE_MUTEXES == 1 ) { /* Only change the priority being used if the task is not - * currently using an inherited priority. */ - if( pxTCB->uxBasePriority == pxTCB->uxPriority ) + * currently using an inherited priority or the new priority + * is bigger than the inherited priority. */ + if( ( pxTCB->uxBasePriority == pxTCB->uxPriority ) || ( uxNewPriority > pxTCB->uxPriority ) ) { pxTCB->uxPriority = uxNewPriority; }