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
@@ -121,18 +121,10 @@ using thread_unlock =
// mutex for specific to type T:
// G4AutoLock l(G4TypeMutex<G4Cache<T>>());
template <typename _Tp>
G4Mutex& G4TypeMutex(const unsigned int& _n = 0)
G4Mutex& G4TypeMutex()
{
static G4Mutex* _mutex = new G4Mutex();
if(_n == 0)
return *_mutex;
static std::vector<G4Mutex*> _mutexes;
if(_n > _mutexes.size())
_mutexes.resize(_n, nullptr);
if(!_mutexes[_n])
_mutexes[_n] = new G4Mutex();
return *(_mutexes[_n - 1]);
static G4Mutex _mutex;
return _mutex;
}
// Helper function for getting a unique static recursive_mutex for a
@@ -143,18 +135,10 @@ G4Mutex& G4TypeMutex(const unsigned int& _n = 0)
// G4RecursiveAutoLock
// l(G4TypeRecursiveMutex<G4Cache<T>>());
template <typename _Tp>
G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
G4RecursiveMutex& G4TypeRecursiveMutex()
{
static auto* _mutex = new G4RecursiveMutex();
if(_n == 0)
return *(_mutex);
static std::vector<G4RecursiveMutex*> _mutexes;
if(_n > _mutexes.size())
_mutexes.resize(_n, nullptr);
if(!_mutexes[_n])
_mutexes[_n] = new G4RecursiveMutex();
return *(_mutexes[_n - 1]);
static G4RecursiveMutex _mutex;
return _mutex;
}
#if defined(G4MULTITHREADED)