Remove obsolete code from prvCheckTasksWaitingTermination().

This commit is contained in:
Richard Barry 2017-05-29 22:55:09 +00:00
parent 533b533820
commit b5d8be2209
2 changed files with 19 additions and 26 deletions

View file

@ -159,6 +159,9 @@ volatile long l1, l2;
TaskHandle_t xTaskToKill; TaskHandle_t xTaskToKill;
const TickType_t xDelay = pdMS_TO_TICKS( ( TickType_t ) 200 ); const TickType_t xDelay = pdMS_TO_TICKS( ( TickType_t ) 200 );
/* Test deletion of a task's secure context, if any. */
portTASK_CALLS_SECURE_FUNCTIONS();
if( pvParameters != NULL ) if( pvParameters != NULL )
{ {
/* This task is periodically created four times. Two created tasks are /* This task is periodically created four times. Two created tasks are

View file

@ -3265,6 +3265,11 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
/** THIS IS THE RTOS IDLE TASK - WHICH IS CREATED AUTOMATICALLY WHEN THE /** THIS IS THE RTOS IDLE TASK - WHICH IS CREATED AUTOMATICALLY WHEN THE
SCHEDULER IS STARTED. **/ SCHEDULER IS STARTED. **/
/* In case a task that has a secure context deletes itself, in which case
the idle task is responsible for deleting the task's secure context, if
any. */
portTASK_CALLS_SECURE_FUNCTIONS();
for( ;; ) for( ;; )
{ {
/* See if any tasks have deleted themselves - if so then the idle task /* See if any tasks have deleted themselves - if so then the idle task
@ -3503,37 +3508,22 @@ static void prvCheckTasksWaitingTermination( void )
#if ( INCLUDE_vTaskDelete == 1 ) #if ( INCLUDE_vTaskDelete == 1 )
{ {
BaseType_t xListIsEmpty; TCB_t *pxTCB;
/* ucTasksDeleted is used to prevent vTaskSuspendAll() being called /* uxDeletedTasksWaitingCleanUp is used to prevent vTaskSuspendAll()
too often in the idle task. */ being called too often in the idle task. */
while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U ) while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
{ {
vTaskSuspendAll(); taskENTER_CRITICAL();
{ {
xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination ); pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );
( void ) uxListRemove( &( pxTCB->xStateListItem ) );
--uxCurrentNumberOfTasks;
--uxDeletedTasksWaitingCleanUp;
} }
( void ) xTaskResumeAll(); taskEXIT_CRITICAL();
if( xListIsEmpty == pdFALSE ) prvDeleteTCB( pxTCB );
{
TCB_t *pxTCB;
taskENTER_CRITICAL();
{
pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );
( void ) uxListRemove( &( pxTCB->xStateListItem ) );
--uxCurrentNumberOfTasks;
--uxDeletedTasksWaitingCleanUp;
}
taskEXIT_CRITICAL();
prvDeleteTCB( pxTCB );
}
else
{
mtCOVERAGE_TEST_MARKER();
}
} }
} }
#endif /* INCLUDE_vTaskDelete */ #endif /* INCLUDE_vTaskDelete */
@ -3763,7 +3753,7 @@ static void prvCheckTasksWaitingTermination( void )
{ {
/* Neither the stack nor the TCB were allocated dynamically, so /* Neither the stack nor the TCB were allocated dynamically, so
nothing needs to be freed. */ nothing needs to be freed. */
configASSERT( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB ) configASSERT( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB );
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} }