Skip to content

[core] Make TROOT::GetFunction more thread-safe - #23222

Draft
vepadulano wants to merge 1 commit into
root-project:masterfrom
vepadulano:core-getfunction-locks
Draft

[core] Make TROOT::GetFunction more thread-safe#23222
vepadulano wants to merge 1 commit into
root-project:masterfrom
vepadulano:core-getfunction-locks

Conversation

@vepadulano

Copy link
Copy Markdown
Member

This method uses a static-initialized atomic boolean modified by a static-initialized immediately-invoked lambda to ensure that either the queried function is returned if available or the ROOT standard functions are initialized before returning the queried function.

This method while theoretically sound has the potential of being wrong because it introduces potential modifications to the fFunctions data member as well as interpreter access via TROOT::ProcessLine without following the locking strategy used in other places of ROOT core.

This commit proposes to introduce the strategy of combining R__[READ,WRITE]_LOCKGUARD(ROOT::gCoreMutex) to ensure thread-safe querying and modification of the ROOT list of functions.

This is related to the various attempts at fixing the cpp11Containers-unorderedMap macro-based test, see #22909 #23021 #23147 #23213

This method uses a static-initialized atomic boolean modified by a
static-initialized immediately-invoked lambda to ensure that either the queried
function is returned if available or the ROOT standard functions are initialized
before returning the queried function.

This method while theoretically sound has the potential of being wrong because
it introduces potential modifications to the fFunctions data member as well as
interpreter access via TROOT::ProcessLine without following the locking strategy
used in other places of ROOT core.

This commit proposes to introduce the strategy of combining
R__[READ,WRITE]_LOCKGUARD(ROOT::gCoreMutex) to ensure thread-safe querying and
modification of the ROOT list of functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant