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




Loading

How to get a list of all task handles?

Posted by helliwell_cj on January 4, 2016

I'm implementing a watchdog function, whereby each task 'checks in' (to indicate it is still alive) by setting a flag/variable; the watchdog monitor periodically makes sure all the current tasks have checked in and, if so, resets the cpu watchdog time and clears the flags. I've got the mechanism basically working, but the monitor needs to know how many and/or which tasks it should expect to hear from. Currently I've used uxTaskGetSystemState(), but it's causing me to miss some UART interrupts [yes, I'm aware that this function is only recommended for debugging]. So is there a neater/faster way to get a list of task handles? I don't need much of the stuff that uxTaskGetSystemState() does (and which presumably cause the lengthy scheduler suspension) - I just need to be able to walk through the list and examine a couple of variables of each TCB.


How to get a list of all task handles?

Posted by davedoors on January 4, 2016

uxTaskGetSystemState() is the normal way, but if it is causing a problem, then how about having your tasks register with the watchdog management task when they are create? That can be done manually by the task implementer or automatically using the trace macros that execute when a task is created and deleted.


How to get a list of all task handles?

Posted by helliwell_cj on January 4, 2016

Yes, I'd starting wondering - if there's no other mechanism already there to use - about patching into the create/delete. I am using Trace functionality too though, so I'd need to wrap extra into the trace macros. Doing it 'manually' could be a bit too much of a risk [of forgetting]. I did also wonder about simply adding my own function to tasks.c - not ideal but, given that I'd need to modify the trace macros anyway, may be just as clean a solution? Bit of a headache to keep re-patching into future updates, though we won't be upgrading the RTOS too often.


How to get a list of all task handles?

Posted by helliwell_cj on January 4, 2016

Just for potentially useful info for others: uxTaskGetSystemState() is taking about ~2ms to execute on my system; with 10 tasks running. The bulk of this time is in finding the stacks' high water marks (prvTaskCheckFreeStackSpace) - commenting this out drops the execution time to ~20us.


[ 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