Skip to content
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

Recursively lock Reflex::Class::PathToBase #26

Closed
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
3 changes: 3 additions & 0 deletions cint/reflex/src/Class.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#if defined(__APPLE__)
# include <AvailabilityMacros.h>
#endif
#include <mutex>

#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_7)
namespace __cxxabiv1 {
Expand All @@ -47,6 +48,7 @@ __dynamic_cast(const void* __src_ptr, // Starting object.
}
#endif

static std::recursive_mutex gPathsToBaseLock;

//-------------------------------------------------------------------------------
Reflex::Class::Class(const char* typ,
Expand Down Expand Up @@ -518,6 +520,7 @@ Reflex::Class::NewBases() const {
const std::vector<Reflex::OffsetFunction>&
Reflex::Class::PathToBase(const Scope& bas) const {
//-------------------------------------------------------------------------------
std::lock_guard<std::recursive_mutex> guard(gPathsToBaseLock);
// Return a vector of offset functions from the current class to the base class.
const BasePath_t* pathToBase = fPathsToBase[bas.Id()];

Expand Down