Always use init once to initialize rpmalloc.

This commit is contained in:
Bartosz Taudul 2020-01-30 19:38:05 +01:00
parent 9a5104dacf
commit 8d5f4d7363

View File

@ -104,7 +104,6 @@ extern "C" typedef BOOL (WINAPI *t_GetLogicalProcessorInformationEx)( LOGICAL_PR
namespace tracy namespace tracy
{ {
#ifndef TRACY_DELAYED_INIT
namespace namespace
{ {
# if ( defined _WIN32 || defined __CYGWIN__ ) && _WIN32_WINNT >= _WIN32_WINNT_VISTA # if ( defined _WIN32 || defined __CYGWIN__ ) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
@ -144,6 +143,8 @@ struct RPMallocInit
} }
}; };
#ifndef TRACY_DELAYED_INIT
struct InitTimeWrapper struct InitTimeWrapper
{ {
int64_t val; int64_t val;
@ -867,12 +868,11 @@ static Thread* s_sysTraceThread = nullptr;
#ifdef TRACY_DELAYED_INIT #ifdef TRACY_DELAYED_INIT
struct ThreadNameData; struct ThreadNameData;
TRACY_API moodycamel::ConcurrentQueue<QueueItem>& GetQueue(); TRACY_API moodycamel::ConcurrentQueue<QueueItem>& GetQueue();
struct RPMallocInit { RPMallocInit() { rpmalloc_initialize(); } };
TRACY_API void InitRPMallocThread() TRACY_API void InitRPMallocThread()
void InitRPMallocThread()
{ {
rpmalloc_initialize(); RPMallocInit rpinit;
rpmalloc_thread_initialize(); rpmalloc_thread_initialize();
} }