ATLAS Offline Software
Loading...
Searching...
No Matches
G4RunToolStateSynchronization.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef G4RUNMANAGEMENT_G4RUNTOOLSTATESYNCHRONIZATION_H
6#define G4RUNMANAGEMENT_G4RUNTOOLSTATESYNCHRONIZATION_H
7
8#include <condition_variable>
9#include <mutex>
10#include <string>
11
25{
26 public:
34
36 void NotifyBeginRun();
38 void RequestFinalize();
40 void Fail(std::string message);
42 void NotifyThreadExit();
44 bool WaitBeginRun(std::string& failureMessage);
46 bool StopRequested() const;
47
48 private:
50 std::string m_failureMessage;
51 mutable std::mutex m_mutex;
52 std::condition_variable m_cv;
53};
54
55#endif
Thread-safe lifecycle state shared by the Athena and Geant4 main threads.
void NotifyBeginRun()
Transition Starting to Running. Ignored in every other state.
bool WaitBeginRun(std::string &failureMessage)
Wait until startup succeeds or the lifecycle reaches a terminal condition.
bool StopRequested() const
Return whether the Geant4 run loop must stop.
void NotifyThreadExit()
Record normal exit after finalization, or failure after an unexpected exit.
@ FinalizeRequested
Athena requested termination of the Geant4 run loop.
@ Running
BeginOfRun was observed; Athena may submit events.
@ Stopped
The Geant4 main thread exited normally; terminal state.
@ Starting
Waiting for the first Geant4 BeginOfRun notification.
@ Failed
The Geant4 main thread failed; terminal state.
void Fail(std::string message)
Transition any non-terminal state to Failed and wake startup waiters.
void RequestFinalize()
Transition Starting or Running to FinalizeRequested.