Add support for event handlers in Executor #10
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What the title says ☝️ .
I haven't added a test for this yet.
I need first to have an event that I can trigger reliably, and I cannot do that with liveliness lost because a lot of API is missing for that (manually assert liveliness API, liveliness policy in QoSProfile, ...).
I think that I will add support to a different event type that can be triggered more easily (maybe I can still get a liveliness lost event with automatic liveliness, I have to double check).
We also should double check what subset of the events machinery we actually need.
On a different note, the current executor code is a bit complex and a lots of things could be simplified (there's a lot of unnecessary iterations that could be merged). I didn't aim to fix that here.
There's also an ownership problem: if you dispose a
Subscriptionand thatSubscriptionis being used in another thread by an Executor, a segfault is likely to happen.Last but not least: the multithreaded executor creates a bunch of threads that are mutually exclusive, so only one thread can do something at a time.
If wait/execute aren't decoupled the multithreaded executor isn't really useful 😂 .