Skip to content

Add uxTaskCallForEachTask, and refactor uxTaskGetSystemState to use it.#1424

Open
DRNadler wants to merge 1 commit into
FreeRTOS:mainfrom
DRNadler:main
Open

Add uxTaskCallForEachTask, and refactor uxTaskGetSystemState to use it.#1424
DRNadler wants to merge 1 commit into
FreeRTOS:mainfrom
DRNadler:main

Conversation

@DRNadler

@DRNadler DRNadler commented Jun 8, 2026

Copy link
Copy Markdown

Get task statistics for all tasks with less memory use, by doing it one task at a time.

Description

Add uxTaskCallForEachTask, which is the iteration portion of last released uxTaskGetSystemState. uxTaskCallForEachTask calls a user-provided callback once for each task with a filled-in TaskStatus_t.

Refactor uxTaskGetSystemState so that it uses uxTaskCallForEachTask to fill in the pre-allocated array of TaskStatus_t, preserving the existing uxTaskGetSystemState API for current users.

Test Steps

  1. Use uxTaskCallForEachTask to observe task statistics for each task in the system.
  2. Compare existing uxTaskGetSystemState output to new version.

Checklist:

  • [x ] I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

Discussed on forum but no Github Issues.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Gets task statistics for all tasks with less memory use.
@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

@aggarg

aggarg commented Jun 21, 2026

Copy link
Copy Markdown
Member

@DRNadler Thank you for your contribution. Could you please review my suggestion: aggarg_suggestion.patch.

This approach is very similar to yours, with the key difference being that it preserves the existing flow of uxTaskGetSystemState and avoids introducing an additional TaskStatus_t variable on the stack, ensuring we don't break existing applications.

Please note that I have not yet compiled or tested this patch, as I wanted to get your feedback first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants