Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


Confused about prvCheckTasksWaitingTermination() function

Posted by ctc8631 on May 9, 2017

Hello, I'm new freeRTOS learner, I try to read v9.0 source code about task.c, and in idle task, it will call prvCheckTasksWaitingTermination()

I'm confused why in this function, it already check there is need deleded task or not by while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U ), Why still need to use xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination ); to check again,and Why it will use vTaskSuspendAll(); and xTaskResumeAll(); to protect listLIST_IS_EMPTY() I found the xTaskResumeAll(), it really takes times

Is there any reason? thanks =) ~~~ static void prvCheckTasksWaitingTermination( void ) {


#if ( INCLUDE_vTaskDelete == 1 )
	BaseType_t xListIsEmpty;

	/* ucTasksDeleted is used to prevent vTaskSuspendAll() being called
	too often in the idle task. */
	while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
			xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination );
		( void ) xTaskResumeAll();

		if( xListIsEmpty == pdFALSE )
			TCB_t *pxTCB;

				pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );
				( void ) uxListRemove( &( pxTCB->xStateListItem ) );

			prvDeleteTCB( pxTCB );
#endif /* INCLUDE_vTaskDelete */

} ~~~

Confused about prvCheckTasksWaitingTermination() function

Posted by rtel on May 9, 2017

Not sure. Looking at it now I would say its probably not necessary. It might be a hang over from before uxDeletedTasksWaitingCleanUp was introduced.

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists