Skip to content

Commit

Permalink
[core] Lock calls to TMetaUtils in TClingTypeInfo
Browse files Browse the repository at this point in the history
Even though it would be better to place the locks in TMetaUtils
directly, TClingUtils.cxx cannot depend from TInterpreter.h (for the
declaration of gInterpreterMutex) as that would cause a circular
dependency. For now, leave the locks in TClingTypeInfo.
  • Loading branch information
vepadulano committed Jul 28, 2023
1 parent 8bd5db8 commit e7be409
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/metacling/src/TClingTypeInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ const char *TClingTypeInfo::Name() const
TTHREAD_TLS_DECL( std::string, buf);
buf.clear();

// TODO: This needs to be locked, but the lock cannot be placed in TClingUtils.cxx as it cannot depend from
// TInterpreter.h for the declaration of gInterpreterMutex. Or can it?
R__LOCKGUARD(gInterpreterMutex);
ROOT::TMetaUtils::GetFullyQualifiedTypeName(buf,fQualType,*fInterp);
return buf.c_str(); // NOLINT
Expand Down Expand Up @@ -242,6 +244,9 @@ const char *TClingTypeInfo::TrueName(const ROOT::TMetaUtils::TNormalizedCtxt &no
TTHREAD_TLS_DECL( std::string, buf);
buf.clear();

// TODO: This needs to be locked, but the lock cannot be placed in TClingUtils.cxx as it cannot depend from
// TInterpreter.h for the declaration of gInterpreterMutex. Or can it?
R__LOCKGUARD(gInterpreterMutex);
ROOT::TMetaUtils::GetNormalizedName(buf,fQualType, *fInterp, normCtxt);

return buf.c_str(); // NOLINT
Expand All @@ -257,6 +262,10 @@ std::string TClingTypeInfo::NormalizedName(const ROOT::TMetaUtils::TNormalizedCt
return "";
}
std::string buf;

// TODO: This needs to be locked, but the lock cannot be placed in TClingUtils.cxx as it cannot depend from
// TInterpreter.h for the declaration of gInterpreterMutex. Or can it?
R__LOCKGUARD(gInterpreterMutex);
ROOT::TMetaUtils::GetNormalizedName(buf,fQualType, *fInterp, normCtxt);

// in C++11 this will be efficient thanks to the move constructor.
Expand Down

0 comments on commit e7be409

Please sign in to comment.