Quality RTOS & Embedded Software

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


uxTaskGetSystemState() != uxTaskGetNumberOfTasks()

Posted by gremond on September 5, 2017

By analyzing a problem with random task disappearing, I added some logs and especially in a task counting nb tasks periodically.

So periodically I get total nb task with uxTaskGetNumberOfTasks() and then I check the status of all task with uxTaskGetSystemState which should return the same number of task, and sometimes I have something like this: . uxTaskGetSystemState returns 49 . uxTaskGetNumberOfTasks returns 26 (which is the correct number)

The documentation say: "The number of TaskStatus_t structures that were populated by uxTaskGetSystemState(). This should equal the number returned by the uxTaskGetNumberOfTasks() API function, but will be zero if the value passed in the uxArraySize parameter was too small."

It still does not explain why I have some task which disappear from the lists but it could be a way to the bug.

I am using FreeRTOS V9.0.0 and upgraded to V9.0.1 (trunk), same issue My board is a STM32L4 in tickless configuration

uxTaskGetSystemState() != uxTaskGetNumberOfTasks()

Posted by rtel on September 6, 2017

There was an issue with vTaskGetInfo(), which is called from uxTaskGetSystemState(), indirectly, but if you have the head revision from SVN then you will already have the fix for that.

uxTaskGetSystemState() != uxTaskGetNumberOfTasks()

Posted by gremond on September 6, 2017

This issue happened with r2518 from SVN

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

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS