Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions core/base/src/TSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -737,31 +737,37 @@ void TSystem::StackTrace()

TSystem *TSystem::FindHelper(const char *path, void *dirptr)
{
if (!fHelpers)
fHelpers = new TOrdCollection;

TPluginHandler *h;
TSystem *helper = nullptr;
if (path) {
if (!GetDirPtr()) {
TUrl url(path, kTRUE);
if (!strcmp(url.GetProtocol(), "file"))
return nullptr;
{
R__READ_LOCKGUARD(ROOT::gCoreMutex);

if (!fHelpers) {
R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
fHelpers = new TOrdCollection;
}
}

// look for existing helpers
TIter next(fHelpers);
while ((helper = (TSystem*) next()))
if (helper->ConsistentWith(path, dirptr))
return helper;
if (path) {
if (!GetDirPtr()) {
TUrl url(path, kTRUE);
if (!strcmp(url.GetProtocol(), "file"))
return nullptr;
}
}

if (!path)
return nullptr;
// look for existing helpers
TIter next(fHelpers);
while ((helper = (TSystem*) next()))
if (helper->ConsistentWith(path, dirptr))
return helper;

if (!path)
return nullptr;
}

// create new helper
TRegexp re("^root.*:"); // also roots, rootk, etc
TString pname = path;
TPluginHandler *h;
if (pname.BeginsWith("xroot:") || pname.Index(re) != kNPOS) {
// (x)rootd daemon ...
if ((h = gROOT->GetPluginManager()->FindHandler("TSystem", path))) {
Expand All @@ -775,8 +781,10 @@ TSystem *TSystem::FindHelper(const char *path, void *dirptr)
helper = (TSystem*) h->ExecPlugin(0);
}

if (helper)
if (helper) {
R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
fHelpers->Add(helper);
}

return helper;
}
Expand Down