-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
sys/event: add event sources #18758
sys/event: add event sources #18758
Conversation
db23b3f
to
60929de
Compare
I like this! And had something similar in mind for a while. Just one thing: The queue that events are posted to are part of the event bus, instead of the event_bus_entry. Also the queue-ptr-in-bus behavior can be trivially implemented with the queue-ptr-in-entry variant (albeit at the extra cost of the ptr per entry vs ptr per bus). What do you think? And bike shedding - naming wise I'm not sure I'm happy with "event bus". What do you think about "event_source", or "event hooks", ...? |
Did you consider using nested structs vs. pointers? events are already using them.
|
Yes, that's why I use pointers here. This way we can use the bus with events that are already extended (e.g. |
Murdock results✔️ PASSED 3b38b29 tests/event_source: add test for event sources
ArtifactsThis only reflects a subset of all builds from https://ci-prod.riot-os.org. Please refer to https://ci.riot-os.org for a complete build for now. |
I agree here, to me this reads as an event fan out construct and less as a bus. I would go with something along the lines of "event_hook" or "event_subscription". What do you think? |
Please squash btw :) |
I'm struggling a bit to find consistent naming with non-bus alternatives. |
How about:
|
Sounds good to me.
I prefer |
Would be fine with me, and consistent. |
Like so? |
I think this is good to go, please squash and maybe fix bus->"event sources" (or similar) in the commit messages. Down the line:
|
This adds an event bus where multiple events can be triggered at once.
Squashed. |
Still interested in this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
I'm curious what we'll build with this! bors merge |
Build succeeded: |
Contribution description
The idea is similar to the message bus, but instead of registering threads to which we send messages, instead we have a list of event handlers that can all be triggered at once.
The advantage is of course that as opposed to messages, events can't be lost.
Testing procedure
A very simple test application has been added to
tests/event_bus
.Issues/PRs references