![]() |
ATLAS Offline Software
|
Thread-safe event handoff between Athena and the Geant4 worker threads. More...
#include <G4RunToolEventQueue.h>
Public Types | |
| using | UPEvent = std::unique_ptr<AtlasG4SyncEventUserInfo> |
Public Member Functions | |
| std::size_t | Size () const |
| void | PushEvent (UPEvent event) |
| Submit a non-null event. Throws std::invalid_argument for null events. | |
| UPEvent | GetEvent () |
| void | Close () noexcept |
| Stop accepting events and wake all Geant4 workers. Idempotent. | |
| void | CompleteOutstandingEvents () noexcept |
| Release abandoned events and report run termination to their waiters. | |
Private Types | |
| using | WeakSyncInterface |
Private Attributes | |
| std::queue< UPEvent > | m_events |
| std::vector< WeakSyncInterface > | m_outstandingEvents |
| bool | m_closed {false} |
| std::mutex | m_mutex |
| std::condition_variable | m_cv |
Thread-safe event handoff between Athena and the Geant4 worker threads.
Events submitted while the queue is open are tracked until their Athena waiters have been notified. Closing the queue wakes every blocked Geant4 worker; subsequent GetEvent() calls return nullptr so that SyncEventAction aborts the run. Once the workers have stopped, CompleteOutstandingEvents() releases any abandoned events and wakes their Athena waiters.
Definition at line 24 of file G4RunToolEventQueue.h.
| using G4RunToolEventQueue::UPEvent = std::unique_ptr<AtlasG4SyncEventUserInfo> |
Definition at line 27 of file G4RunToolEventQueue.h.
|
private |
Definition at line 42 of file G4RunToolEventQueue.h.
|
noexcept |
Stop accepting events and wake all Geant4 workers. Idempotent.
Definition at line 69 of file G4RunToolEventQueue.cxx.
|
noexcept |
Release abandoned events and report run termination to their waiters.
Must be called only after all Geant4 workers have stopped. Idempotent.
Definition at line 78 of file G4RunToolEventQueue.cxx.
| auto G4RunToolEventQueue::GetEvent | ( | ) |
Definition at line 56 of file G4RunToolEventQueue.cxx.
| void G4RunToolEventQueue::PushEvent | ( | UPEvent | event | ) |
Submit a non-null event. Throws std::invalid_argument for null events.
Definition at line 17 of file G4RunToolEventQueue.cxx.
| std::size_t G4RunToolEventQueue::Size | ( | ) | const |
Definition at line 11 of file G4RunToolEventQueue.cxx.
|
private |
Definition at line 47 of file G4RunToolEventQueue.h.
|
private |
Definition at line 49 of file G4RunToolEventQueue.h.
|
private |
Definition at line 45 of file G4RunToolEventQueue.h.
|
mutableprivate |
Definition at line 48 of file G4RunToolEventQueue.h.
|
private |
Definition at line 46 of file G4RunToolEventQueue.h.