Skip to content
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

Event Groups: snapshot xEventGroupSetBits returning value while in vTaskSuspendAll #1143

Merged
merged 4 commits into from
Sep 11, 2024

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
event_groups.c Outdated Show resolved Hide resolved
@aggarg
Copy link
Member

aggarg commented Sep 11, 2024

Please merge main to fix the CI failure.

Copy link

@aggarg aggarg merged commit d3052f1 into FreeRTOS:main Sep 11, 2024
16 checks passed
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