diff options
author | B Stack <bgstack15@gmail.com> | 2018-10-17 02:11:26 +0000 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2018-10-17 02:11:26 +0000 |
commit | f70f8f961ef8f4d909266f71310e3515f25928e6 (patch) | |
tree | 89b2a018482c164bdd8ecac5c76b19a08f420dec /zen/thread.cpp | |
parent | Merge branch '10.4' into 'master' (diff) | |
parent | 10.5 (diff) | |
download | FreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.tar.gz FreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.tar.bz2 FreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.zip |
Merge branch '10.5' into 'master'10.5
10.5
See merge request opensource-tracking/FreeFileSync!2
Diffstat (limited to 'zen/thread.cpp')
-rwxr-xr-x | zen/thread.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/zen/thread.cpp b/zen/thread.cpp index 8016d4a9..08bfaa25 100755 --- a/zen/thread.cpp +++ b/zen/thread.cpp @@ -34,10 +34,7 @@ uint64_t getThreadIdNative() } -struct InitMainThreadIdOnStartup -{ - InitMainThreadIdOnStartup() { getMainThreadId(); } -} startupInitMainThreadId; +const uint64_t globalMainThreadId = getThreadId(); //avoid code-gen for "magic static"! } @@ -50,6 +47,9 @@ uint64_t zen::getThreadId() uint64_t zen::getMainThreadId() { - static const uint64_t mainThreadId = getThreadId(); - return mainThreadId; + //don't make this a function-scope static (avoid code-gen for "magic static") + if (globalMainThreadId == 0) //might be called during static initialization + return getThreadId(); + + return globalMainThreadId; } |