mirror of
https://github.com/Z3Prover/z3
synced 2025-06-03 04:41:21 +00:00
Use C++11 thread_local for portability.
This should work on all supported compilers rather than using __declspec(thread) and __thread.
This commit is contained in:
parent
852acd0e75
commit
a332eb10bc
1 changed files with 2 additions and 9 deletions
|
@ -241,15 +241,8 @@ void * memory::allocate(char const* file, int line, char const* obj, size_t s) {
|
||||||
// when the local counter > SYNCH_THRESHOLD
|
// when the local counter > SYNCH_THRESHOLD
|
||||||
#define SYNCH_THRESHOLD 100000
|
#define SYNCH_THRESHOLD 100000
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
thread_local long long g_memory_thread_alloc_size = 0;
|
||||||
// Actually this is VS specific instead of Windows specific.
|
thread_local long long g_memory_thread_alloc_count = 0;
|
||||||
__declspec(thread) long long g_memory_thread_alloc_size = 0;
|
|
||||||
__declspec(thread) long long g_memory_thread_alloc_count = 0;
|
|
||||||
#else
|
|
||||||
// GCC style
|
|
||||||
__thread long long g_memory_thread_alloc_size = 0;
|
|
||||||
__thread long long g_memory_thread_alloc_count = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void synchronize_counters(bool allocating) {
|
static void synchronize_counters(bool allocating) {
|
||||||
#ifdef PROFILE_MEMORY
|
#ifdef PROFILE_MEMORY
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue