Skip to content

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

Open
DRNadler wants to merge 2 commits into
FreeRTOS:mainfrom
DRNadler:main
Open

Add uxTaskCallForEachTask, and refactor uxTaskGetSystemState to use it.#1439
DRNadler wants to merge 2 commits into
FreeRTOS:mainfrom
DRNadler:main

Conversation

@DRNadler

@DRNadler DRNadler commented Jun 29, 2026

Copy link
Copy Markdown

Get task statistics for all tasks with less memory use, by doing it one task at a time.
Provide a public iterator over all tasks for diagnostics.

@aggarg - This is a better refactoring and does not increase stack space use (from #1424):

  • The public iterator function is cleaner (passes task handle and state plus context to callback).
  • Does not replicate task location code as in your suggested patch.
  • Based on the latest development head for easier merge.
  • Retested in my application.

Hope you approve!

Description

Add uxTaskCallForEachTask, which is the iteration portion of last released uxTaskGetSystemState. uxTaskCallForEachTask calls a user-provided callback once for each task (with the task handle and state, plus a context).

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.

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant