Open penfree opened 1 year ago
i have gdb into the core.
(gdb) p _eventStreams
$1 = std::vector of length 0, capacity 0
(gdb) p _eventToStream
$2 = std::map with 3 elements = {
[0x55fad188f928 <dexode::eventbus::internal::type_id_ptr<dolphin::StreamAddEvent>::id>] = 0x55fad26f2510,
[0x55fad18907f8 <dexode::eventbus::internal::type_id_ptr<dolphin::StreamRemoveEvent>::id>] = 0x55fad26af030,
[0x55fad1891a48 <dexode::eventbus::internal::type_id_ptr<dolphin::StreamStatusChangeEvent>::id>] = 0x7f4644005fa0}
(gdb) quit
Hello, could you send more ? I mean parts of your code? I will try to check again this part of code. Thanks. Some questions:
Hello, could you send more ? I mean parts of your code? I will try to check again this part of code. Thanks. Some questions:
- Do you use EventBus in multithreaded environment ? (Send events in one thread, process in another)
- Do you call process() in multiple threads?
the code is almost the same as readme, except it is called in multithread environment.
Overall there should be only 1 thread that consumes ( calls process()
). You can send events from any thread ( calling postpone(Event)
). I will try write test for your use-case. I think I didn't tested it like that.
Usually you have 1 consumer thread for example main thread that will process events and call your listeners. Thanks to that you always know on what thread you listeners would be executed.
Overall there should be only 1 thread that consumes ( calls
process()
). You can send events from any thread ( callingpostpone(Event)
). I will try write test for your use-case. I think I didn't tested it like that.
oh, that is not easy to do. so i should use a cycle thread to consume the events?
Ok nvm, I will create test for this. Maybe there is a bug.
In source code I see there is already mutex for "single process"
std::lock_guard writeGuardProcess{_mutexProcess}; // Only one process at the time
Ok nvm, I will create test for this. Maybe there is a bug.
In source code I see there is already mutex for "single process"
std::lock_guard writeGuardProcess{_mutexProcess}; // Only one process at the time
emm, i saw that too, so maybe mutex is missed somewhere. i found that when call frequency is slow, it works well
Thanks, I will find issue and fix it soon (I will try this weekend). My best guess for now that there is some data race between process() and postpone()
@gelldur is there any progress?
Sorry didn't have time. I will try soon. If you find solution It would be nice to merge your PR :)
I got an exception and the program crashed, i don't really know how to reproduce it, it is not triggered by a special parameter. would you please help me to figure it out. @gelldur
The error log: /thirdparty/EventBus-3.0.4/lib/src/dexode/EventBus.cpp:57: std::size_t dexode::EventBus::processLimit(std::size_t): Assertion `removeFrom != _eventStreams.end()' failed.
The source code is here: