mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-05-12 11:42:57 -04:00
fix: use inherited priority for event item value in vTaskPrioritySet
When a task holds a mutex and has an inherited priority, the event list item value should reflect the effective priority (pxTCB->uxPriority) rather than the requested new priority (uxNewPriority). Using uxNewPriority can result in incorrect ordering in the event waiting list, leading to deadlock when a task tries to acquire multiple mutexes. Fixes #1364
This commit is contained in:
parent
f1043c49d5
commit
a53e9337e9
1 changed files with 1 additions and 1 deletions
2
tasks.c
2
tasks.c
|
|
@ -2936,7 +2936,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
* being used for anything else. */
|
* being used for anything else. */
|
||||||
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0U ) )
|
if( ( listGET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ) ) & taskEVENT_LIST_ITEM_VALUE_IN_USE ) == ( ( TickType_t ) 0U ) )
|
||||||
{
|
{
|
||||||
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxNewPriority ) );
|
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxTCB->uxPriority ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue