diff --git a/src/mem/threadalloc.h b/src/mem/threadalloc.h index 4f6b674..c7d23f1 100644 --- a/src/mem/threadalloc.h +++ b/src/mem/threadalloc.h @@ -71,7 +71,6 @@ namespace snmalloc # pragma warning(pop) # endif #else - /** * Holds the thread local state for the allocator. The state is constant * initialised, and has no direct dectructor. Instead snmalloc will call @@ -137,7 +136,8 @@ namespace snmalloc Singleton p_key; // We need to set a non-null value, so that the destructor is called, // we never look at the value. - pthread_setspecific(p_key.get(), reinterpret_cast(1)); + static char p_teardown_val = 1; + pthread_setspecific(p_key.get(), &p_teardown_val); # ifdef SNMALLOC_TRACING std::cout << "Using pthread clean up" << std::endl; # endif