Skip to content

Conversation

@skotopes
Copy link
Contributor

@skotopes skotopes commented Sep 10, 2024

Event Groups: snapshot xEventGroupSetBits returning value while in vTaskSuspendAll

Description

Event Groups: snapshot xEventGroupSetBits returning value while in vTaskSuspendAll.
Fixes uxEventBits dereference after event group deleted by higher priority thread.

Test Steps

Code example that causes issues: https://github.com/flipperdevices/flipperzero-firmware/blob/78c5dd95d867941206e1be2fd3585c9c76132bd7/furi/core/timer.c#L43

General flow to reproduce issue:

  • In High Priority Thread:
    • Place StaticEventGroup_t on stack and initialize
    • Call xTimerPendFunctionCall, pass reference to callback and event group handler
    • Call xEventGroupWaitBits
    • Delete Event Group
  • In callback(which will be executed in timer thread):
    • use xEventGroupSetBits
    • check returned result

Previously return results was not guaranteed because High Priority Thread deleted EventGroup before uxEventBits dereference.
In this PR result will be as described in documentation.

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.

Related Issue

#1142

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

…askSuspendAll. Fixes uxEventBits dereference after event group deleted by higher priority thread.
@skotopes skotopes requested a review from a team as a code owner September 10, 2024 18:54
@skotopes skotopes marked this pull request as draft September 10, 2024 18:55
@skotopes
Copy link
Contributor Author

@aggarg Do I need to contribute unit tests to https://github.com/FreeRTOS/FreeRTOS first?

@skotopes skotopes marked this pull request as ready for review September 10, 2024 19:09
@aggarg
Copy link
Member

aggarg commented Sep 11, 2024

Please merge main to fix the CI failure.

@sonarqubecloud
Copy link

@aggarg aggarg merged commit d3052f1 into FreeRTOS:main Sep 11, 2024
moninom1 pushed a commit to moninom1/FreeRTOS-Kernel that referenced this pull request Sep 30, 2025
* Exclude examples in FreeRTOS-Kernel from build
* Update vega and microsemi risc-v eclipse project
* Update polarfire eclipse project
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