diff options
author | Jack Lloyd <[email protected]> | 2019-01-28 15:13:59 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-01-30 19:28:39 -0500 |
commit | d9a5ffe01f33d509afac68563dbb26a9dc8b9ef6 (patch) | |
tree | af3605c57ef457a2987b842908f702966082ec97 /src/lib/utils/compiler.h | |
parent | 8c835b3b1238083c4b4bb4a90e4d9e9b38dffb11 (diff) |
Refactor CPUID to make it thread safe
Needed for #1819 and unfortunately Windows does not allow thread local
data to be stored as a member of a DLL exported class. So hide it
behind an accessor function instead.
This slows down CPUID test somewhat and I would like to address that
but it seems hard without breaking the CPUID API, which is for better
or worse public.
Diffstat (limited to 'src/lib/utils/compiler.h')
-rw-r--r-- | src/lib/utils/compiler.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/utils/compiler.h b/src/lib/utils/compiler.h index fa8e1cfbf..9dfbd9fa2 100644 --- a/src/lib/utils/compiler.h +++ b/src/lib/utils/compiler.h @@ -131,6 +131,15 @@ #endif /* +* Define BOTAN_THREAD_LOCAL +*/ +#if defined(BOTAN_TARGET_OS_HAS_THREADS) + #define BOTAN_THREAD_LOCAL thread_local +#else + #define BOTAN_THREAD_LOCAL /**/ +#endif + +/* * Define BOTAN_IF_CONSTEXPR */ |