EventBus icon indicating copy to clipboard operation
EventBus copied to clipboard

Improve with read/write mutexes

Open gelldur opened this issue 5 years ago • 0 comments

AsyncEventBus uses normal std::mutex, maybe (probably) better approach would be to use read/write mutex e.g. std::shared_mutex

We can consider adding listener as write (we can benefit of changing capacity to even improve that), and making notification as read. This ticket needs some investigation is it possible and what need to be done to achieve better concurrency.

It would be nice to have:

  • Some performance test to compare new/old approach. Please attach results old/new to PR.
  • Unit test (if possible) of some multithreaded environment to test it.

May think about: (If you have any further suggestions please comment)

  • How to achieve single "class" to not have separate AsyncEventBus and EventBus
  • Maybe use some kind of CRTP to achieve thread safety ?

gelldur avatar Jun 05 '19 16:06 gelldur