SHiP Geometry Service
Framework-agnostic C++20 library wrapping the SHiP GeoModel geometry behind a stable interface.
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
ship::GeometryThread Class Reference

Runs posted tasks on one dedicated thread until destroyed. More...

#include <GeometryThread.h>

Public Member Functions

 ~GeometryThread ()=default
 
 GeometryThread (const GeometryThread &)=delete
 
GeometryThreadoperator= (const GeometryThread &)=delete
 
 GeometryThread (GeometryThread &&)=delete
 
GeometryThreadoperator= (GeometryThread &&)=delete
 
template<typename F >
requires std::invocable<F&>
std::invoke_result_t< F & > run (F &&f)
 Run f on the geometry thread and return its result.
 

Friends

GeometryThreadgeometry_thread ()
 The process-wide Geant4 geometry thread, shared by every geometry user (GENIE geometry analyzers, the Geant4 run-manager master) and never torn down (a parked thread at exit is harmless).
 

Detailed Description

Runs posted tasks on one dedicated thread until destroyed.

Geant4 MT split-class state (logical/physical volumes, solids) is only valid on the thread that created it, so every creation or mutation of converted geometry must be funnelled through here. Callers block until their task finishes; exceptions propagate. Safe to call from multiple threads concurrently: tasks queue and run one at a time.

Constructor & Destructor Documentation

◆ ~GeometryThread()

ship::GeometryThread::~GeometryThread ( )
default

◆ GeometryThread() [1/2]

ship::GeometryThread::GeometryThread ( const GeometryThread )
delete

◆ GeometryThread() [2/2]

ship::GeometryThread::GeometryThread ( GeometryThread &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

GeometryThread & ship::GeometryThread::operator= ( const GeometryThread )
delete

◆ operator=() [2/2]

GeometryThread & ship::GeometryThread::operator= ( GeometryThread &&  )
delete

◆ run()

template<typename F >
requires std::invocable<F&>
std::invoke_result_t< F & > ship::GeometryThread::run ( F &&  f)
inline

Run f on the geometry thread and return its result.

Reentrant: a call made from a task already running on the geometry thread executes f inline instead of deadlocking on its own queue slot.

Friends And Related Symbol Documentation

◆ geometry_thread

GeometryThread & geometry_thread ( )
friend

The process-wide Geant4 geometry thread, shared by every geometry user (GENIE geometry analyzers, the Geant4 run-manager master) and never torn down (a parked thread at exit is harmless).

Geant4 MT allows only a single geometry-*creating* thread per process: G4GeomSplitter's slot count is shared across threads while the data array is thread-local, so a second creating thread writes through its still-null array pointer the moment the first thread has grown the shared count (Geant4 bug #2747, verified with the conda Geant4 11.3 build). Defined in the shared library so dlopened plugins all see the same instance.


The documentation for this class was generated from the following files: