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

Linearize Event Ordering In The FreeRTOS Implementation #14

Open
linkmonitor opened this issue Mar 9, 2023 · 0 comments
Open

Linearize Event Ordering In The FreeRTOS Implementation #14

linkmonitor opened this issue Mar 9, 2023 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@linkmonitor
Copy link
Owner

Background

The FreeRTOS implementation does not guarantee that all tasks see all events in the same order.

The FreeRTOS implementation posts events to subscribing tasks' queues in priority order, from highest to lowest. If a subscribing task (Sub) has a higher priority than the sending task (Send), the FreeRTOS scheduler delivers that event to Sub as soon as it enters its queue, before Send has a chance to post it to other event queues. If Sub sends events in response to the event it receives, those new events will enter other tasks' queues before those from Send even though they occurred logically after them.

Options

  1. Add a lightweight mutex to ErSendEx() that forces previous calls to complete before new calls start. This uses "priority inheritance" to linearize event ordering when there are overlapping sends. This can be made to have (almost) no cost in the case where there is no contention.
  2. Disable the scheduler in ErSendEx() while posting events to queues. This is simpler than 1 but costs more.
@linkmonitor linkmonitor added enhancement New feature or request bug Something isn't working labels Mar 9, 2023
@linkmonitor linkmonitor changed the title Unify Event Ordering In FreeRTOS Implementation Linearize Event Ordering In The FreeRTOS Implementation Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant