Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -48,6 +48,7 @@
#include <iomanip>
#include <iostream>
#include <limits>
#include <optional>
#include "globals.hh"
#include "tls.hh"
@@ -115,15 +116,15 @@ class G4StatAnalysis
// Timing (member functions)
inline G4double GetCpuTime() const;
// Timing (static functions)
static tms*& GetCpuClock()
static tms* GetCpuClock()
{
G4ThreadLocalStatic tms* _instance = nullptr;
if(!_instance)
G4ThreadLocalStatic std::optional<tms> _instance(std::nullopt);
if(_instance == std::nullopt)
{
_instance = new tms;
times(_instance);
_instance = tms();
times(&_instance.value());
}
return _instance;
return &_instance.value();
}
// Note: this above implementation was implemented in such a way as to
// conserve memory by eliminated every instance from requiring their own
@@ -133,7 +134,7 @@ class G4StatAnalysis
// manually invoke in some situations
static void ResetCpuClock()
{
tms*& _clock = GetCpuClock();
tms* _clock = GetCpuClock();
times(_clock);
}