26 static std::shared_ptr<ROOT::Internal::TPoolManager> &R__GetPoolManagerMT()
28 static std::shared_ptr<ROOT::Internal::TPoolManager> schedMT;
32 static bool &GetImplicitMTFlag()
34 static bool enabled =
false;
38 static std::atomic_int &GetParBranchProcessingCount()
40 static std::atomic_int count(0);
44 static std::atomic_int &GetParTreeProcessingCount()
46 static std::atomic_int count(0);
50 extern "C" void ROOT_TImplicitMT_EnableImplicitMT(UInt_t numthreads)
52 if (!GetImplicitMTFlag()) {
53 if (ROOT::Internal::TPoolManager::GetPoolSize() == 0) {
54 TThread::Initialize();
56 R__GetPoolManagerMT() = ROOT::Internal::GetPoolManager(numthreads);
57 GetImplicitMTFlag() =
true;
59 ::Warning(
"ROOT_TImplicitMT_EnableImplicitMT",
"Implicit multi-threading is already enabled");
63 extern "C" void ROOT_TImplicitMT_DisableImplicitMT()
65 if (GetImplicitMTFlag()) {
66 GetImplicitMTFlag() =
false;
67 R__GetPoolManagerMT().reset();
69 ::Warning(
"ROOT_TImplicitMT_DisableImplicitMT",
"Implicit multi-threading is already disabled");
73 extern "C" UInt_t ROOT_TImplicitMT_GetImplicitMTPoolSize()
75 return ROOT::Internal::TPoolManager::GetPoolSize();
79 extern "C" void ROOT_TImplicitMT_EnableParBranchProcessing()
81 ++GetParBranchProcessingCount();
84 extern "C" void ROOT_TImplicitMT_DisableParBranchProcessing()
86 --GetParBranchProcessingCount();
89 extern "C" bool ROOT_TImplicitMT_IsParBranchProcessingEnabled()
91 return GetParBranchProcessingCount() > 0;
94 extern "C" void ROOT_TImplicitMT_EnableParTreeProcessing()
96 ++GetParTreeProcessingCount();
99 extern "C" void ROOT_TImplicitMT_DisableParTreeProcessing()
101 --GetParTreeProcessingCount();
104 extern "C" bool ROOT_TImplicitMT_IsParTreeProcessingEnabled()
106 return GetParTreeProcessingCount() > 0;