MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / prvCheckTasksWaitingTermination

Function prvCheckTasksWaitingTermination

tasks.c:4565–4607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4563/*-----------------------------------------------------------*/
4564
4565static void prvCheckTasksWaitingTermination( void )
4566{
4567 /** THIS FUNCTION IS CALLED FROM THE RTOS IDLE TASK **/
4568
4569 #if ( INCLUDE_vTaskDelete == 1 )
4570 {
4571 TCB_t * pxTCB;
4572
4573 /* uxDeletedTasksWaitingCleanUp is used to prevent taskENTER_CRITICAL()
4574 * being called too often in the idle task. */
4575 while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
4576 {
4577 taskENTER_CRITICAL();
4578 {
4579 /* Since we are SMP, multiple idles can be running simultaneously
4580 * and we need to check that other idles did not cleanup while we were
4581 * waiting to enter the critical section */
4582 if( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
4583 {
4584 pxTCB = listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) ); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
4585
4586 if( pxTCB->xTaskRunState == taskTASK_NOT_RUNNING )
4587 {
4588 ( void ) uxListRemove( &( pxTCB->xStateListItem ) );
4589 --uxCurrentNumberOfTasks;
4590 --uxDeletedTasksWaitingCleanUp;
4591 prvDeleteTCB( pxTCB );
4592 }
4593 else
4594 {
4595 /* The TCB to be deleted still has not yet been switched out
4596 * by the scheduler, so we will just exit this loop early and
4597 * try again next time. */
4598 taskEXIT_CRITICAL();
4599 break;
4600 }
4601 }
4602 }
4603 taskEXIT_CRITICAL();
4604 }
4605 }
4606 #endif /* INCLUDE_vTaskDelete */
4607}
4608/*-----------------------------------------------------------*/
4609
4610#if ( configUSE_TRACE_FACILITY == 1 )

Callers 1

tasks.cFile · 0.85

Calls 2

uxListRemoveFunction · 0.85
prvDeleteTCBFunction · 0.85

Tested by

no test coverage detected