-
Notifications
You must be signed in to change notification settings - Fork 3k
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
EventQueue should permit static allocation #9172
Comments
Staring a bit harder, I see that Seems like it could be split so that effectively |
Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-352 |
@kjbracey-arm could you file it as a PREQ? I think it's very important our scheduler/event-loop doesn't rely on dynamic memory. It's just yet another thing that can go wrong. |
Thank you for raising this issue. Please note we have updated our policies and |
For the record, this feature was implemented by #11342 |
Description
EventQueue
andEvent
always require an allocation to perform acall
orcall_in
, meaning it can fail.This is potentially fatal for state machines - there is no plan B if the queue fails.
There should be an alternative form that allows the storage for the
struct equeue_event
to be static, so thecall
cannot fail.An analogous mechanism is provided in Nanostack's
eventOS_event.h
:eventOS_event_send_user_allocated
.I had previously thought that the
equeue
allocation mechanism and the dispatch mechanism were inherently coupled, meaning this would require an involved rework, but I now think that isn't the case. All the dispatching is just based on a linked list, no?Looking at the API, it seems to me that we have a ready-made answer.
Event
could store thestruct equeue_event
as a member, rather than a pointer to one it allocates from the queue. It appears the existing API would fully support that - theequeue_event
has the same lifetime as theEvent
, and its size is can be calculated at compile time from the templating.It almost seems as if
Event
was made for this purpose...Issue request type
The text was updated successfully, but these errors were encountered: