JeffersonLab / JANA2

Multi-threaded HENP Event Reconstruction
https://jeffersonlab.github.io/JANA2/
Other
6 stars 9 forks source link

Refactoring: Move topology and arrow bookkeeping into JScheduler #259

Closed nathanwbrei closed 10 months ago

nathanwbrei commented 10 months ago

Previously, our design attempted to separate the logic for shutting down individual arrows (and ultimately the whole topology) from the scheduling logic. These two things are not in fact independent, and this led to many headaches and issues such as #227. This refactoring moves all shutdown logic and bookkeeping state into the scheduler so that everyone sees a consistent view of the entire topology status. This gets rid of a number of atomic variables and puts everything behind one mutex. This improves the legibility of the design because the JScheduler class now encapsulates all state that needs the mutex's protection. This is not expected to hurt performance because the topology shutdown only happens at the very end of processing, and is ~O(number of arrows), which in typical use cases ranges from 2 to 6.