Skip to content

control: Synchronize run based on control state

Giovanna Lazzari Miotto requested to merge glazzari/control-synchronization into main

This MR introduces a monitoring thread that runs concurrently with SCDAQ. This thread listens to external changes to the `ctrl` structure (instigated by the Function Manager) that regulate the start and end of runs, triggering logic to smoothly transition SCDAQ between run states.

Key changes:

  • Every call to the InputFilter functor InputFilter(void*) checks that the atomic ctrl::running is true, otherwise, the input sends a nullptr to the remaining pipeline stages. This will signal the pipeline teardown once all packets are processed.
  • A parallel monitoring thread is tasked with polling the contents of the ctrl structure, namely the current state and run number, triggering actions needed to start a new run or to wrap a current one, e.g. writing the End-of-Run file.
  • For efficiency w.r.t. busy-waiting clock cycles, the polling above is implemented through mutexed condition variables.
  • Now, SCDAQ starts in a standby state, waiting for the first run number to be received by session and the ctrl structure.
  • Due to the above, the test suite now calls a Python script that emulates the Function Manager sending a start command through TCP to begin SCDAQ operations.
Edited by Giovanna Lazzari Miotto

Merge request reports