ispringtech / FastSignals

Easy to use, fast and lightweight C++17 signals and slots library, drop-in replacement for the Boost.Signals2
MIT License
25 stars 10 forks source link

Implemented shared_connection_block #8

Closed Warboss-rus closed 5 years ago

sergey-shambir commented 5 years ago
  1. Method advanced_connection::advanced_connection_impl::block contains race: two different thread can in the same moment block when m_blocker still doesn't exist, so two blockers can be created and there will be data race for m_blocker assignment. Even if assignment will not cause problems itself, incorrect blocker will be returned to one of the caller threads.
Warboss-rus commented 5 years ago
  1. Added spinlock mutex to protect the blocker. There is also potential race in shared_connection_block::block(), but I don't think using single shared_connection_block from multiple threads is a valid use case.