-
Notifications
You must be signed in to change notification settings - Fork 34
fix making static locals thread safe #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix making static locals thread safe #712
Conversation
having static locals can be risky and we might want to move them into the InterpreterInfo class
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #712 +/- ##
==========================================
+ Coverage 81.46% 81.49% +0.03%
==========================================
Files 9 9
Lines 4213 4221 +8
==========================================
+ Hits 3432 3440 +8
Misses 781 781
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
std::lock_guard<std::recursive_mutex> Lock(gWrapperStoreMutex); | ||
auto R = gWrapperStore.find(FD); | ||
if (R != gWrapperStore.end()) | ||
return (JitCall::GenericCall)R->second; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]
return (JitCall::GenericCall)R->second;
^
std::lock_guard<std::recursive_mutex> Lock(gDtorWrapperStoreMutex); | ||
auto I = gDtorWrapperStore.find(D); | ||
if (I != gDtorWrapperStore.end()) | ||
return (JitCall::DestructorCall)I->second; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]
return (JitCall::DestructorCall)I->second;
^
Description
Having static locals can be risky, and we might want to move them into the InterpreterInfo class.
Will open an issue on this; we can fix it later. I want to first make sure that this fixes the random crashes seen in our CI since the merge of thread-safety PR.
Fixes # (issue)
Hopfully this fixes the random failures that we are seeing in the CI.
Type of change
Please tick all options which are relevant.
TODOs for MySelf
parent
andinterp
as arguments. LikeCpp::GetNamed
...