Skip to content

OnlineMonitor: Resolving Issues with Threading

Simon Spannagel requested to merge onlinemon into master

This MR contains some fixups to !650 (merged) since @pschutze and me experienced issues with some modules when attempting do online monitoring, manifesting itself in seemingly random crashes deep within different parts of ROOT, changing whenever restarting.

This was traced back to be a threading issue, so this MR implements the following changes:

  • The TApplication is created on the main thread - this removes the random crashes but leaves the spawned thread with an empty ROOT directory
  • Passing the gDirectory ti the spawned GUI thread and cd()ing into it explicitly restores access to the histograms
  • The gui_running is now a std::atomic<bool> to be thread-safe
  • An additional gui_ready atomic bool blocks the main thread initialize() method until the GUI has been properly initialized. This removes possible race conditions between histogram creating/filling in other modules and the booking and access thereof from the GUI thread.

@aloeschc would you be so kind to look at this and test this since it touches your work?

Merge request reports