-
Notifications
You must be signed in to change notification settings - Fork 81
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
Example of dexode::eventbus::perk::PassEverythingPerk wrong #36
Comments
Thanks if something isn't straight forward then there is issue in design (bad design). If now I understand correctly your case. You want add this 'perk' to because now in your example all events which you add to -- |
Yes, my intent is that every thread would post events to the I am still not sure I understand how it works though. I changed the buses around as below:
Then it seems that it doesn't pass any events. |
As you describe. EventBus is just single bus. You can use "perks" to achieve something else like passing events from bus1 to bus2. You may just create your own wrapper instead which will combine those 2 event buses so when you post event to your wrapper it will be calling bus1->postpone and bus2->postpone. Now in thread1 you need to call bus1->process() (to process scheduled events) Also you can use perk which you mentioned above then such wrapper could be created using third bus but then you need to "eat"/process scheduled events. If I understand correctly you intention is that you want to communicate between 2 threads? E.g. event in UI will be post event which should be handled in worker thread and vice-versa ? Worth to mention: PassEverythingPerk::onPrePostponeEvent return Flag::postpone_cancel so events won't be duplicated. If you want such behavior then please make your own simple perk with different return. |
This is more of a concrete example of the desired operation for #6.
https://wandbox.org/permlink/YUaGMcgiwgtdRHE6
The issue is I obviously am misunderstanding something. If I run the example with line 131 as the following
I get the output:
I would expect to see:
Am I misunderstanding the operation of
dexode::eventbus::perk::PassEverythingPerk
in that on line 126:Should cause
subordinate
to get all the events fromeventBus
forwarded to it. Then whensubordinate->process();
is called it will process the event listeners on that bus.NOTE: I am assuming my understanding is flawed, but correcting the misunderstanding to reflect the intent will "close" this issue. I will then make a PR with the corrected example. Feel free to change the issue title to something more appropriate.
Thanks!
The text was updated successfully, but these errors were encountered: