mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Fix for using Tracy with multithreaded NT loader in Windows 10 RS5 (Issue #26).
This commit is contained in:
parent
6f9b4aeac9
commit
27447902ef
@ -56,6 +56,7 @@
|
|||||||
#if defined _MSC_VER || defined __CYGWIN__
|
#if defined _MSC_VER || defined __CYGWIN__
|
||||||
# include <lmcons.h>
|
# include <lmcons.h>
|
||||||
extern "C" typedef LONG (WINAPI *t_RtlGetVersion)( PRTL_OSVERSIONINFOW );
|
extern "C" typedef LONG (WINAPI *t_RtlGetVersion)( PRTL_OSVERSIONINFOW );
|
||||||
|
# define TRACY_USE_INITONCE (1)
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
@ -73,12 +74,40 @@ namespace tracy
|
|||||||
|
|
||||||
struct RPMallocInit
|
struct RPMallocInit
|
||||||
{
|
{
|
||||||
RPMallocInit() { rpmalloc_initialize(); }
|
RPMallocInit()
|
||||||
|
{
|
||||||
|
#if defined TRACY_USE_INITONCE
|
||||||
|
rpmalloc_thread_initialize();
|
||||||
|
#else
|
||||||
|
rpmalloc_initialize();
|
||||||
|
#endif //if defined TRACY_USE_INITONCE
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined TRACY_USE_INITONCE
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
BOOL CALLBACK InitOnceCallback(
|
||||||
|
PINIT_ONCE initOnce,
|
||||||
|
PVOID Parameter,
|
||||||
|
PVOID *Context)
|
||||||
|
{
|
||||||
|
rpmalloc_initialize();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //if defined TRACY_USE_INITONCE
|
||||||
|
|
||||||
struct RPMallocThreadInit
|
struct RPMallocThreadInit
|
||||||
{
|
{
|
||||||
RPMallocThreadInit() { rpmalloc_thread_initialize(); }
|
RPMallocThreadInit()
|
||||||
|
{
|
||||||
|
#if defined TRACY_USE_INITONCE
|
||||||
|
static INIT_ONCE InitOnce = INIT_ONCE_STATIC_INIT;
|
||||||
|
InitOnceExecuteOnce(&InitOnce, InitOnceCallback, nullptr, nullptr);
|
||||||
|
#endif //if defined TRACY_USE_INITONCE
|
||||||
|
rpmalloc_thread_initialize();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InitTimeWrapper
|
struct InitTimeWrapper
|
||||||
|
Loading…
Reference in New Issue
Block a user