Skip to content

Commit dad8587

Browse files
committed
Merge pull request #64 from Dr15Jones/avoidDataRaceWithStaticInTFormulaAnalyzeFunction
Assign directly to static variable to avoid race condition
2 parents 36ff87d + c0e247e commit dad8587

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

hist/hist/src/TFormula.cxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,7 @@ Bool_t TFormula::AnalyzeFunction(TString &chaine, Int_t &err, Int_t offset)
420420

421421
// ROOT does yet have a complete TType class, but TCling does,
422422
// so let's use that for now.
423-
static TypeInfo_t *doubletype = 0;
424-
if (doubletype == 0) {
425-
doubletype = gInterpreter->TypeInfo_Factory("double");
426-
}
423+
static TypeInfo_t * const doubletype{ gInterpreter->TypeInfo_Factory("double") };
427424
std::vector<TypeInfo_t*> proto(nargs,doubletype);
428425

429426
CallFunc_t *callfunc = gInterpreter->CallFunc_Factory();

0 commit comments

Comments
 (0)