ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Threading.hh File Reference
#include "globals.hh"
#include "G4Types.hh"
#include <chrono>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <future>
#include <vector>
+ Include dependency graph for G4Threading.hh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  G4DummyThread
 

Namespaces

namespace  G4ThisThread
 
namespace  G4Threading
 

Macros

#define G4THREADSLEEP(tick)   std::this_thread::sleep_for(std::chrono::seconds( tick ))
 
#define G4MUTEX_INITIALIZER   {}
 
#define G4MUTEXINIT(mutex)   ;;
 
#define G4MUTEXDESTROY(mutex)   ;;
 
#define G4MUTEXLOCK(mutex)   ;;
 
#define G4MUTEXUNLOCK(mutex)   ;;
 
#define G4THREADJOIN(worker)   ;;
 
#define G4CONDITION_INITIALIZER   1
 
#define G4CONDITIONWAIT(cond, mutex)   G4ConsumeParameters(cond, mutex);
 
#define G4CONDITIONWAITLAMBDA(cond, mutex, lambda)   G4ConsumeParameters(cond, mutex, lambda);
 
#define G4CONDITIONNOTIFY(cond)   G4ConsumeParameters(cond);
 
#define G4CONDITIONBROADCAST(cond)   G4ConsumeParameters(cond);
 

Typedefs

template<typename _Tp >
using G4Future = std::future< _Tp >
 
template<typename _Tp >
using G4SharedFuture = std::shared_future< _Tp >
 
template<typename _Tp >
using G4Promise = std::promise< _Tp >
 
using G4Mutex = std::mutex
 
using G4RecursiveMutex = std::recursive_mutex
 
using G4ThreadFunReturnType = void *
 
using G4ThreadFunArgType = void *
 
using thread_lock = G4int(*)(G4Mutex *)
 
using thread_unlock = G4int(*)(G4Mutex *)
 
using G4Thread = G4DummyThread
 
using G4NativeThread = G4DummyThread::native_handle_type
 
using G4Pid_t = G4int
 
using G4Condition = G4int
 
using G4ThreadId = G4Thread::id
 

Enumerations

enum  { G4Threading::SEQUENTIAL_ID = -2, G4Threading::MASTER_ID = -1, G4Threading::WORKER_ID = 0, G4Threading::GENERICTHREAD_ID = -1000 }
 

Functions

template<typename _Tp >
G4MutexG4TypeMutex (const unsigned int &_n=0)
 
template<typename _Tp >
G4RecursiveMutexG4TypeRecursiveMutex (const unsigned int &_n=0)
 
template<typename _Worker , typename _Func , typename... _Args>
void G4THREADCREATE (_Worker *&worker, _Func func, _Args...args)
 
G4Pid_t G4Threading::G4GetPidId ()
 
G4int G4Threading::G4GetNumberOfCores ()
 
G4int G4Threading::G4GetThreadId ()
 
G4bool G4Threading::IsWorkerThread ()
 
G4bool G4Threading::IsMasterThread ()
 
void G4Threading::G4SetThreadId (G4int aNewValue)
 
G4bool G4Threading::G4SetPinAffinity (G4int idx, G4NativeThread &at)
 
void G4Threading::SetMultithreadedApplication (G4bool value)
 
G4bool G4Threading::IsMultithreadedApplication ()
 
int G4Threading::WorkerThreadLeavesPool ()
 
int G4Threading::WorkerThreadJoinsPool ()
 
G4int G4Threading::GetNumberOfRunningWorkerThreads ()
 

Macro Definition Documentation

#define G4CONDITION_INITIALIZER   1

Definition at line 251 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 251 of file G4Threading.hh

#define G4CONDITIONBROADCAST (   cond)    G4ConsumeParameters(cond);

Definition at line 255 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 255 of file G4Threading.hh

Referenced by G4MTBarrier::ReleaseBarrier(), and G4MTBarrier::ThisWorkerReady().

#define G4CONDITIONNOTIFY (   cond)    G4ConsumeParameters(cond);

Definition at line 254 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 254 of file G4Threading.hh

#define G4CONDITIONWAIT (   cond,
  mutex 
)    G4ConsumeParameters(cond, mutex);

Definition at line 252 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 252 of file G4Threading.hh

Referenced by G4MTBarrier::ThisWorkerReady(), and G4MTBarrier::Wait().

#define G4CONDITIONWAITLAMBDA (   cond,
  mutex,
  lambda 
)    G4ConsumeParameters(cond, mutex, lambda);

Definition at line 253 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 253 of file G4Threading.hh

#define G4MUTEX_INITIALIZER   {}

Definition at line 88 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 88 of file G4Threading.hh

Referenced by doiPETEventAction::EndOfEventAction(), and TSRun::RecordEvent().

#define G4MUTEXLOCK (   mutex)    ;;

Definition at line 234 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 234 of file G4Threading.hh

Referenced by G4NuclearLevelData::AddPrivateData(), G4VisManager::BeginOfRun(), G4NistMaterialBuilder::BuildNistMaterial(), G4UPiNuclearCrossSection::BuildPhysicsTable(), G4ComponentBarNucleonNucleusXsc::BuildPhysicsTable(), G4BGGNucleonElasticXS::BuildPhysicsTable(), G4BGGNucleonInelasticXS::BuildPhysicsTable(), G4NeutronInelasticXS::BuildPhysicsTable(), G4NeutronElasticXS::BuildPhysicsTable(), G4ParticleInelasticXS::BuildPhysicsTable(), G4BGGPionElasticXS::BuildPhysicsTable(), G4NeutronCaptureXS::BuildPhysicsTable(), G4BGGPionInelasticXS::BuildPhysicsTable(), G4EnergyLossForExtrapolator::BuildTables(), G4ImportanceAlgorithm::Calculate(), G4Material::ComputeDensityEffectOnFly(), G4WentzelVIRelModel::ComputeEffectiveMass(), G4EmParameters::Dump(), G4VisManager::EndOfEvent(), G4VisManager::EndOfRun(), G4ElasticHadrNucleusHE::FillData(), G4NistElementBuilder::FindOrBuildElement(), G4ParticleTable::FindParticle(), G4BinaryCascade::G4BinaryCascade(), G4BinaryLightIonReaction::G4BinaryLightIonReaction(), G4ElasticHadrNucleusHE::G4ElasticHadrNucleusHE(), G4LossTableBuilder::G4LossTableBuilder(), G4VAtomDeexcitation::G4VAtomDeexcitation(), G4NistManager::GetICRU90StoppingData(), G4IStore::GetImportance(), G4NuclearLevelData::GetInstance(), G4IonTable::GetIon(), G4NuclearLevelData::GetLevelManager(), G4IonTable::GetMuonicAtom(), G4ComponentSAIDTotalXS::Initialise(), G4WentzelOKandVIxSection::InitialiseA(), G4ICRU49NuclearStoppingModel::InitialiseArray(), G4SeltzerBergerModel::InitialiseForElement(), G4LivermorePhotoElectricModel::InitialiseForElement(), G4PhotonEvaporation::InitialiseGRData(), G4NuMuNucleusCcModel::InitialiseModel(), G4NuMuNucleusNcModel::InitialiseModel(), G4NeutronInelasticXS::InitialiseOnFly(), G4NeutronCaptureXS::InitialiseOnFly(), G4NeutronElasticXS::InitialiseOnFly(), G4ParticleInelasticXS::InitialiseOnFly(), G4ConcreteMesonBaryonToResonance::InitialisePointers(), G4FermiBreakUpVI::InitialisePool(), G4VUserPhysicsList::InitializeProcessManager(), G4EmParameters::Instance(), G4NistManager::Instance(), G4IStore::IsKnown(), G4GeneralParticleSourceData::Lock(), G4VUserPhysicsList::RemoveProcessManager(), G4EmParameters::SetBirksActive(), G4Material::SetChemicalFormula(), G4DeexPrecoParameters::SetDefaults(), G4NistManager::SetDensityEffectCalculatorFlag(), G4IonisParamMat::SetDensityEffectParameters(), G4Material::SetFreeElectronDensity(), G4Material::SetMaterialPropertiesTable(), G4NistManager::SetVerbose(), G4NuclearLevelData::UploadNuclearLevelData(), G4ParticleTable::WorkerG4ParticleTable(), and G4EnergyLossForExtrapolator::~G4EnergyLossForExtrapolator().

#define G4MUTEXUNLOCK (   mutex)    ;;

Definition at line 235 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 235 of file G4Threading.hh

Referenced by G4NuclearLevelData::AddPrivateData(), G4VisManager::BeginOfRun(), G4NistMaterialBuilder::BuildNistMaterial(), G4UPiNuclearCrossSection::BuildPhysicsTable(), G4ComponentBarNucleonNucleusXsc::BuildPhysicsTable(), G4BGGNucleonElasticXS::BuildPhysicsTable(), G4BGGNucleonInelasticXS::BuildPhysicsTable(), G4NeutronInelasticXS::BuildPhysicsTable(), G4NeutronElasticXS::BuildPhysicsTable(), G4ParticleInelasticXS::BuildPhysicsTable(), G4BGGPionElasticXS::BuildPhysicsTable(), G4NeutronCaptureXS::BuildPhysicsTable(), G4BGGPionInelasticXS::BuildPhysicsTable(), G4EnergyLossForExtrapolator::BuildTables(), G4ImportanceAlgorithm::Calculate(), G4Material::ComputeDensityEffectOnFly(), G4WentzelVIRelModel::ComputeEffectiveMass(), G4EmParameters::Dump(), G4VisManager::EndOfEvent(), G4VisManager::EndOfRun(), G4ElasticHadrNucleusHE::FillData(), G4NistElementBuilder::FindOrBuildElement(), G4ParticleTable::FindParticle(), G4BinaryCascade::G4BinaryCascade(), G4BinaryLightIonReaction::G4BinaryLightIonReaction(), G4ElasticHadrNucleusHE::G4ElasticHadrNucleusHE(), G4LossTableBuilder::G4LossTableBuilder(), G4VAtomDeexcitation::G4VAtomDeexcitation(), G4NistManager::GetICRU90StoppingData(), G4IStore::GetImportance(), G4NuclearLevelData::GetInstance(), G4IonTable::GetIon(), G4NuclearLevelData::GetLevelManager(), G4IonTable::GetMuonicAtom(), G4ComponentSAIDTotalXS::Initialise(), G4WentzelOKandVIxSection::InitialiseA(), G4ICRU49NuclearStoppingModel::InitialiseArray(), G4SeltzerBergerModel::InitialiseForElement(), G4LivermorePhotoElectricModel::InitialiseForElement(), G4PhotonEvaporation::InitialiseGRData(), G4NuMuNucleusCcModel::InitialiseModel(), G4NuMuNucleusNcModel::InitialiseModel(), G4NeutronInelasticXS::InitialiseOnFly(), G4NeutronCaptureXS::InitialiseOnFly(), G4NeutronElasticXS::InitialiseOnFly(), G4ParticleInelasticXS::InitialiseOnFly(), G4ConcreteMesonBaryonToResonance::InitialisePointers(), G4FermiBreakUpVI::InitialisePool(), G4VUserPhysicsList::InitializeProcessManager(), G4EmParameters::Instance(), G4NistManager::Instance(), G4IStore::IsKnown(), G4VUserPhysicsList::RemoveProcessManager(), G4EmParameters::SetBirksActive(), G4Material::SetChemicalFormula(), G4DeexPrecoParameters::SetDefaults(), G4NistManager::SetDensityEffectCalculatorFlag(), G4IonisParamMat::SetDensityEffectParameters(), G4Material::SetFreeElectronDensity(), G4Material::SetMaterialPropertiesTable(), G4NistManager::SetVerbose(), G4GeneralParticleSourceData::Unlock(), G4NuclearLevelData::UploadNuclearLevelData(), G4ParticleTable::WorkerG4ParticleTable(), and G4EnergyLossForExtrapolator::~G4EnergyLossForExtrapolator().

#define G4THREADJOIN (   worker)    ;;

Definition at line 238 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 238 of file G4Threading.hh

Referenced by G4VisManager::EndOfRun().

#define G4THREADSLEEP (   tick)    std::this_thread::sleep_for(std::chrono::seconds( tick ))

Definition at line 52 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 52 of file G4Threading.hh

Referenced by G4VisManager::EndOfEvent().

Typedef Documentation

using G4Condition = G4int

Definition at line 250 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 250 of file G4Threading.hh

template<typename _Tp >
typedef std::future< _Tp > G4Future

Definition at line 56 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 56 of file G4Threading.hh

using G4Mutex = std::mutex

Definition at line 84 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 84 of file G4Threading.hh

Definition at line 231 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 231 of file G4Threading.hh

using G4Pid_t = G4int

Definition at line 240 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 240 of file G4Threading.hh

template<typename _Tp >
typedef std::promise< _Tp > G4Promise

Definition at line 58 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 58 of file G4Threading.hh

using G4RecursiveMutex = std::recursive_mutex

Definition at line 85 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 85 of file G4Threading.hh

template<typename _Tp >
typedef std::shared_future< _Tp > G4SharedFuture

Definition at line 57 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 57 of file G4Threading.hh

Definition at line 230 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 230 of file G4Threading.hh

Definition at line 103 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 103 of file G4Threading.hh

Definition at line 102 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 102 of file G4Threading.hh

Definition at line 262 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 262 of file G4Threading.hh

using thread_lock = G4int(*)(G4Mutex*)

Definition at line 104 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 104 of file G4Threading.hh

using thread_unlock = G4int(*)(G4Mutex*)

Definition at line 105 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 105 of file G4Threading.hh

Function Documentation

template<typename _Worker , typename _Func , typename... _Args>
void G4THREADCREATE ( _Worker *&  worker,
_Func  func,
_Args...  args 
)

Definition at line 245 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 245 of file G4Threading.hh

Referenced by G4VisManager::BeginOfRun(), and main().

+ Here is the caller graph for this function:

template<typename _Tp >
G4Mutex& G4TypeMutex ( const unsigned int _n = 0)

Definition at line 114 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 114 of file G4Threading.hh

Referenced by G4Cache< VALTYPE >::G4Cache(), and G4Cache< VALTYPE >::~G4Cache().

+ Here is the caller graph for this function:

template<typename _Tp >
G4RecursiveMutex& G4TypeRecursiveMutex ( const unsigned int _n = 0)

Definition at line 135 of file G4Threading.hh.

View newest version in sPHENIX GitHub at line 135 of file G4Threading.hh