core: prevent static initialization issue with Time::Resolution on Cppyy 3

This commit is contained in:
Gabriel Ferreira
2023-04-01 10:56:44 -03:00
parent 23b9cda56f
commit 06845023d1
2 changed files with 6 additions and 3 deletions

View File

@@ -653,8 +653,7 @@ class Time
*/
static inline Resolution* PeekResolution()
{
static Time::Resolution& resolution{SetDefaultNsResolution()};
return &resolution;
return &m_resolution;
}
/**
@@ -832,7 +831,8 @@ class Time
friend Time& operator-=(Time& lhs, const Time& rhs);
/**@}*/ // Compound assignment
int64_t m_data; //!< Virtual time value, in the current unit.
int64_t m_data; //!< Virtual time value, in the current unit.
static Time::Resolution m_resolution; //!< The current time resolution
}; // class Time

View File

@@ -91,6 +91,9 @@ Time::MarkedTimes* Time::g_markingTimes = nullptr;
/// The static mutex for critical sections around modification of Time::g_markingTimes.
static std::mutex g_markingMutex;
// The resolution of the Time class
Time::Resolution Time::m_resolution{SetDefaultNsResolution()};
// Function called to force static initialization
// static
bool