Skip to content

Clarify documentation of xTaskNumber in TaskStatus_t. #1081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

schilkp
Copy link
Contributor

@schilkp schilkp commented Jun 5, 2024

Description

Discussed here: https://forums.freertos.org/t/tracing-improvements/20097

Adds a note to the (confusingly named) xTaskNumber member of TaskStatus_t explaining that the value is different to the TaskNumber that can be accessed using the vTaskSetTaskNumber and vTaskGetTaskNumber functions.

The value returned is actually the value of uxTCBNumber in the TCB.

Note that documentation on the website should also be updated (https://www.freertos.org/vTaskGetInfo.html#TaskStatus_t). Is this done automatically based on code comments or does this need to be done manually?

Thanks!

Test Steps

N/A

Checklist:

  • 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.
    N/A

Related Issue

N/A

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

@schilkp schilkp requested a review from a team as a code owner June 5, 2024 07:44
@kar-rahul-aws
Copy link
Member

Hi @schilkp
Thank you for the PR. The documentation on the website will be updated by us, once this PR is reviewed and merged.

include/task.h Outdated
@@ -161,7 +161,7 @@ typedef struct xTASK_STATUS
{
TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */
const char * pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */
UBaseType_t xTaskNumber; /* A number unique to the task. */
UBaseType_t xTaskNumber; /* A number unique to the task. Note that this is not the task number that may be modified using vTaskSetTaskNumber() and vTaskGetTaskNumber, but a separate TCB-specific and unique identifier automatically assigned on task generation. */
Copy link
Member

@kar-rahul-aws kar-rahul-aws Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. uxTaskGetTaskNumber() instead of vTaskGetTaskNumber .
  2. We should also change xTaskNumber to uxTasknumber for naming convention, since its of type UBaseType_t . I can update this in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uxTaskGetTaskNumber() instead of vTaskGetTaskNumber.

Good catch. Fixed.

We should also change xTaskNumber to uxTasknumber for naming convention, since its of type UBaseType_t . I can update this in a separate PR.

My original proposal was to rename this member to uxTCBNumber which matches the internal implementation. The member uxTCBNumber in a TCB is the unique ID for each TCB, while uxTaskNumber is the value accessed using the above mentioned functions.

It was my understanding from some posts buried in my discussion (here)[https://forums.freertos.org/t/tracing-improvements/20097/7] that changing the name was not an option because it broken compatibility/kernel-aware debuggers.

If a rename is on the table, I would push for making this much less confusing :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this , thanks , yes it will be breaking change in some of the ports.

Discussed here: https://forums.freertos.org/t/tracing-improvements/20097

Adds a note to the (confusingly named) xTaskNumber member of TaskStatus_t
explaining that the value is different to the TaskNumber that can be
accessed using the vTaskSetTaskNumber and vTaskGetTaskNumber functions.

The value returned is actually the value of uxTCBNumber in the TCB.
@schilkp schilkp force-pushed the schilkp/taskstatus_documentation branch from cefdf25 to 881c540 Compare June 5, 2024 21:08
Copy link

sonarqubecloud bot commented Jun 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@aggarg aggarg merged commit 69e1b7c into FreeRTOS:main Jun 6, 2024
16 checks passed
AhmedIsmail02 pushed a commit to AhmedIsmail02/FreeRTOS-Kernel that referenced this pull request Jun 12, 2024
Discussed here: https://forums.freertos.org/t/tracing-improvements/20097

Adds a note to the (confusingly named) xTaskNumber member of TaskStatus_t
explaining that the value is different to the TaskNumber that can be
accessed using the vTaskSetTaskNumber and vTaskGetTaskNumber functions.

The value returned is actually the value of uxTCBNumber in the TCB.
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.

3 participants