FreeRTOS / FreeRTOS-Kernel

FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
https://www.FreeRTOS.org
MIT License
2.51k stars 1.05k forks source link

list.c: improve code comments to point to official documentation about problems which may cause code to get stuck inside of list.c #1051

Closed ElectricRCAircraftGuy closed 1 month ago

ElectricRCAircraftGuy commented 1 month ago

Description

Improve comments to help people when debugging. This would have saved me weeks of time. An uninitialized binary semaphore (ie: one which has not been given yet) will result in getting stuck inside of vListInsert(). You must give it before taking it.

Test Steps

Create a semaphore, start the scheduler, try to take it. You'll get stuck in a debugger inside the for loop in VListInsert().

Now, right after creating it, but before starting the scheduler, give it. Start the scheduler. Now, when it is taken it works fine.

Checklist:

Can someone please run necessary tests on your end to ensure this is behavior you see too?

Related Issue

NA

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

kstribrnAmzn commented 1 month ago

Hello @ElectricRCAircraftGuy! Thanks for submitting the PR. I like the idea of improving the documentation but I believe this case is well covered by both our website documentation and in the semaphore header. I'd like to leave the documentation there to keep a single authoritative source. Updating the list source code comment to point the authoritative documentation will ensure comments stay up to date with the behavior.

Please see my suggestions about how to rework the comment.

sonarcloud[bot] commented 1 month ago

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

ElectricRCAircraftGuy commented 1 month ago

Thanks @kar-rahul-aws and @aggarg for incorporating the intent of my changes! I appreciate it. Looks good to me.