mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Only check once before re-setting ready priority
The macro taskRESET_READY_PRIORITY checks if the task being removed from the ready list is the last one and only then resets the top ready priority by calling portRESET_READY_PRIORITY. If we already know that it is the last ready task being removed then there is no need to perform the check again and the macro portRESET_READY_PRIORITY can be called directly. We were doing the unnecessary check at two places and this commit fixes them. This commit also increases the time period of check task to ensure that all the demo tasks get a chance to run before the check is performed.
This commit is contained in:
parent
004e2b637e
commit
7235743749
|
@ -244,7 +244,7 @@ int main_full( void )
|
||||||
static void prvCheckTask( void *pvParameters )
|
static void prvCheckTask( void *pvParameters )
|
||||||
{
|
{
|
||||||
TickType_t xNextWakeTime;
|
TickType_t xNextWakeTime;
|
||||||
const TickType_t xCycleFrequency = pdMS_TO_TICKS( 2500UL );
|
const TickType_t xCycleFrequency = pdMS_TO_TICKS( 4000UL );
|
||||||
|
|
||||||
/* Just to remove compiler warning. */
|
/* Just to remove compiler warning. */
|
||||||
( void ) pvParameters;
|
( void ) pvParameters;
|
||||||
|
|
|
@ -1164,7 +1164,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
|
||||||
being deleted. */
|
being deleted. */
|
||||||
pxTCB = prvGetTCBFromHandle( xTaskToDelete );
|
pxTCB = prvGetTCBFromHandle( xTaskToDelete );
|
||||||
|
|
||||||
/* Remove task from the ready list. */
|
/* Remove task from the ready/delayed list. */
|
||||||
if( uxListRemove( &( pxTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
|
if( uxListRemove( &( pxTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
||||||
|
@ -3981,7 +3981,10 @@ TCB_t *pxTCB;
|
||||||
{
|
{
|
||||||
if( uxListRemove( &( pxMutexHolderTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
|
if( uxListRemove( &( pxMutexHolderTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( pxMutexHolderTCB->uxPriority );
|
/* It is known that the task is in its ready list so
|
||||||
|
there is no need to check again and the port level
|
||||||
|
reset macro can be called directly. */
|
||||||
|
portRESET_READY_PRIORITY( pxMutexHolderTCB->uxPriority, uxTopReadyPriority );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4061,7 +4064,7 @@ TCB_t *pxTCB;
|
||||||
the mutex. If the mutex is held by a task then it cannot be
|
the mutex. If the mutex is held by a task then it cannot be
|
||||||
given from an interrupt, and if a mutex is given by the
|
given from an interrupt, and if a mutex is given by the
|
||||||
holding task then it must be the running state task. Remove
|
holding task then it must be the running state task. Remove
|
||||||
the holding task from the ready list. */
|
the holding task from the ready/delayed list. */
|
||||||
if( uxListRemove( &( pxTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
|
if( uxListRemove( &( pxTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
||||||
|
@ -4182,7 +4185,10 @@ TCB_t *pxTCB;
|
||||||
{
|
{
|
||||||
if( uxListRemove( &( pxTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
|
if( uxListRemove( &( pxTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
|
||||||
{
|
{
|
||||||
taskRESET_READY_PRIORITY( pxTCB->uxPriority );
|
/* It is known that the task is in its ready list so
|
||||||
|
there is no need to check again and the port level
|
||||||
|
reset macro can be called directly. */
|
||||||
|
portRESET_READY_PRIORITY( pxTCB->uxPriority, uxTopReadyPriority );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue