uppsrc: thread__ -> thread_local

git-svn-id: svn://ultimatepp.org/upp/trunk@13388 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-06-13 09:00:26 +00:00
parent bfb36b813c
commit 48eb19fff1
4 changed files with 16 additions and 17 deletions

View file

@ -304,7 +304,14 @@ Color DarkThemeCached(Color c)
ocolor[i] = Color(255, 255, 255);
}
}
} cache;
}
#ifdef COMPILER_MINGW
tcache;
static FastMingwTls<Cache *> 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);

View file

@ -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()
{

View file

@ -8,7 +8,7 @@ namespace Upp {
static StaticMutex sGLock;
static thread__ int sGLockLevel = 0;
static thread_local int sGLockLevel = 0;
void EnterGuiMutex()
{

View file

@ -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();