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


using a thread's own task handle

Posted by *anonymous on April 29, 2008

Richard Barry et al

In a previous release, the following code was placed in VTaskDelete() ___/* Ensure a yield is performed if the current task is being ___deleted. */ ___if( pxTaskToDelete == pxCurrentTCB ) ___{ ___pxTaskToDelete = NULL; ___}

This ensures that a task can properly delete itself using its own task handle rather than NULL.

I thought similar code was also added to vTaskPrioritySet() although so far I have been unable to pin this down. Maybe I had added that myself. But the bottom line is that such code is needed. In the current version, if a task drops its own priority (using its task handle rather than NULL) below another ready task, the other ready task will not be properly scheduled to run (until the next re-scheduling for some other reason).


using a thread's own task handle

Posted by richardbarry on May 1, 2008

Looking at the history, it was also put into vTaskSuspend(), but not vTaskPrioritySet().  I have just added it in and will check in the changes very shortly.

Can you see anywhere else it should be added before I check it in?  I think that's it.


using a thread's own task handle

Posted by *anonymous on May 1, 2008

I think maybe the following in vTaskResume() needs should exclude the current task handle as well as NULL.

if( pxTCB != NULL ) {

using a thread's own task handle

Posted by richardbarry on May 1, 2008

>if( pxTCB != NULL ) >{

I have added the second check here:

if( ( pxTCB != NULL ) && ( pxTCB != pxCurrentTCB ) ) {

but arguably both could be removed as attempting to resume yourself (using either parameter) would be very odd.

Changes now checked in.


using a thread's own task handle

Posted by *anonymous on May 1, 2008

Yes, that's why I was somewhat uncertain about the change to the resume function - however, SafeRTOS needs it, I presume.

[ 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