Skip to content

Commit

Permalink
Use INCLUDE_vTaskDelete for task deletion in vTaskEndScheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
chinglee-iot committed Jan 25, 2024
1 parent 88f20df commit 4053f79
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3738,8 +3738,6 @@ void vTaskStartScheduler( void )

void vTaskEndScheduler( void )
{
TCB_t * pxTCB;

traceENTER_vTaskEndScheduler();

/* Stop the scheduler interrupts and call the portable scheduler end
Expand All @@ -3748,18 +3746,24 @@ void vTaskEndScheduler( void )
portDISABLE_INTERRUPTS();
xSchedulerRunning = pdFALSE;

/* Delete tasks waiting for termination. */
while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
#if ( INCLUDE_vTaskDelete == 1 )
{
/* MISRA Ref 11.5.3 [Void pointer assignment] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
/* coverity[misra_c_2012_rule_11_5_violation] */
pxTCB = listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );
( void ) uxListRemove( &( pxTCB->xStateListItem ) );
--uxCurrentNumberOfTasks;
--uxDeletedTasksWaitingCleanUp;
prvDeleteTCB( pxTCB );
TCB_t * pxTCB;

/* Delete tasks waiting for termination. */
while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
{
/* MISRA Ref 11.5.3 [Void pointer assignment] */
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
/* coverity[misra_c_2012_rule_11_5_violation] */
pxTCB = listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );
( void ) uxListRemove( &( pxTCB->xStateListItem ) );
--uxCurrentNumberOfTasks;
--uxDeletedTasksWaitingCleanUp;
prvDeleteTCB( pxTCB );
}
}
#endif /* #if ( INCLUDE_vTaskDelete == 1 ) */

vPortEndScheduler();

Expand Down

0 comments on commit 4053f79

Please sign in to comment.