diff --git a/uppsrc/Core/Color.cpp b/uppsrc/Core/Color.cpp index 2f44e3bf7..ca960e54a 100644 --- a/uppsrc/Core/Color.cpp +++ b/uppsrc/Core/Color.cpp @@ -304,7 +304,14 @@ Color DarkThemeCached(Color c) ocolor[i] = Color(255, 255, 255); } } - } cache; + } +#ifdef COMPILER_MINGW + tcache; + static FastMingwTls tls_cache = &tcache; + Cache& cache = *tls_cache; +#else + cache; +#endif #define DO(i) if(cache.icolor[i] == c) return cache.ocolor[i]; DO(0); DO(1); DO(2); DO(3); DO(4); DO(5); DO(6); DO(7); cache.ii = (cache.ii + 1) & (N - 1); diff --git a/uppsrc/Core/SSL/InitExit.cpp b/uppsrc/Core/SSL/InitExit.cpp index 7f2051f1c..b823614d6 100644 --- a/uppsrc/Core/SSL/InitExit.cpp +++ b/uppsrc/Core/SSL/InitExit.cpp @@ -98,8 +98,8 @@ EXITBLOCK #if defined(_MULTITHREADED) && OPENSSL_VERSION_NUMBER < 0x10100000L -static thread__ bool sThreadInit; -static thread__ void (*sPrevExit)(); +static thread_local bool sThreadInit; +static thread_local void (*sPrevExit)(); static void sslExitThread() { diff --git a/uppsrc/CtrlCore/CtrlMt.cpp b/uppsrc/CtrlCore/CtrlMt.cpp index ff2c799c3..30ce09f77 100644 --- a/uppsrc/CtrlCore/CtrlMt.cpp +++ b/uppsrc/CtrlCore/CtrlMt.cpp @@ -8,7 +8,7 @@ namespace Upp { static StaticMutex sGLock; -static thread__ int sGLockLevel = 0; +static thread_local int sGLockLevel = 0; void EnterGuiMutex() { diff --git a/uppsrc/Draw/Font.cpp b/uppsrc/Draw/Font.cpp index 480c86ab6..991de8024 100644 --- a/uppsrc/Draw/Font.cpp +++ b/uppsrc/Draw/Font.cpp @@ -433,7 +433,7 @@ CharEntry GetGlyphEntry(Font font, int chr, unsigned hash) return e; } -thread__ CharEntry fc_cache[512]; +thread_local CharEntry fc_cache[512]; GlyphInfo GetGlyphInfo(Font font, int chr) { @@ -504,7 +504,7 @@ struct FontEntry { int64 font; }; -thread__ FontEntry fi_cache[63]; +thread_local FontEntry fi_cache[63]; const CommonFontInfo& GetFontInfo(Font font) { @@ -531,20 +531,12 @@ int Font::GetRightSpace(int c) const { return GetGlyphMetrics(*this, c).rspc; } -thread__ int64 lastFiFont = INT_MIN; -thread__ CommonFontInfo lastFontInfo; -thread__ int64 lastStdFont = INT_MIN; - +thread_local int64 lastFiFont = INT_MIN; +thread_local CommonFontInfo lastFontInfo; +thread_local int64 lastStdFont = INT_MIN; const CommonFontInfo& Font::Fi() const { -#ifdef PLATFORM_OSX11 -// known leak on MacOSX here: getAllCarbonLazyValues2000 calls Core.h op new() -// should not call UPP op new() -// from GetFontInfo() ... XftFontOpenPattern() ... getAllCarbonLazyValues2000() -> new() - MemoryIgnoreLeaksBlock __; -#endif - if(lastStdFont != AStdFont.AsInt64()) { lastFiFont = INT_MIN; lastStdFont = AStdFont.AsInt64();