HltEventLoopMgr: fix race condition during stop
Deleting the HLT::LoopThread
objects is not thread-safe and can lead to race conditions between the main thread deleting them and the callbacks still using them. Also std::unique_ptr::reset
is not atomic. Instead of deleting, just wait for the threads to finish. For stop/start transitions, the objects will be replaced during the next call to nextEvent
.
This will be cherry-picked into 24.0 after a few days.
Relates to ATR-30102.
cc @ssottoco