mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 05:03:53 +00:00
RPMallocInit and RPMallocThreadInit are identical.
This commit is contained in:
parent
28220a5fbf
commit
9c28b82954
@ -128,23 +128,6 @@ struct RPMallocInit
|
|||||||
pthread_once( &once_control, InitOnceCallback );
|
pthread_once( &once_control, InitOnceCallback );
|
||||||
# else
|
# else
|
||||||
std::call_once( once_flag, InitOnceCallback );
|
std::call_once( once_flag, InitOnceCallback );
|
||||||
# endif
|
|
||||||
// We must call rpmalloc_thread_initialize() explicitly here since the InitOnceCallback might
|
|
||||||
// not be called on this thread if another thread has executed it earlier.
|
|
||||||
rpmalloc_thread_initialize();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct RPMallocThreadInit
|
|
||||||
{
|
|
||||||
RPMallocThreadInit()
|
|
||||||
{
|
|
||||||
# if ( defined _WIN32 || defined __CYGWIN__ ) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
|
||||||
InitOnceExecuteOnce( &InitOnce, InitOnceCallback, nullptr, nullptr );
|
|
||||||
# elif defined __linux__
|
|
||||||
pthread_once( &once_control, InitOnceCallback );
|
|
||||||
# else
|
|
||||||
std::call_once( once_flag, InitOnceCallback );
|
|
||||||
# endif
|
# endif
|
||||||
rpmalloc_thread_initialize();
|
rpmalloc_thread_initialize();
|
||||||
}
|
}
|
||||||
@ -918,7 +901,6 @@ struct ThreadNameData;
|
|||||||
TRACY_API moodycamel::ConcurrentQueue<QueueItem>& GetQueue();
|
TRACY_API moodycamel::ConcurrentQueue<QueueItem>& GetQueue();
|
||||||
|
|
||||||
struct RPMallocInit { RPMallocInit() { rpmalloc_initialize(); } };
|
struct RPMallocInit { RPMallocInit() { rpmalloc_initialize(); } };
|
||||||
struct RPMallocThreadInit { RPMallocThreadInit() { rpmalloc_thread_initialize(); } };
|
|
||||||
|
|
||||||
TRACY_API void InitRPMallocThread()
|
TRACY_API void InitRPMallocThread()
|
||||||
{
|
{
|
||||||
@ -950,7 +932,6 @@ struct ProfilerThreadData
|
|||||||
{
|
{
|
||||||
ProfilerThreadData( ProfilerData& data ) : token( data ), gpuCtx( { nullptr } ) {}
|
ProfilerThreadData( ProfilerData& data ) : token( data ), gpuCtx( { nullptr } ) {}
|
||||||
RPMallocInit rpmalloc_init;
|
RPMallocInit rpmalloc_init;
|
||||||
RPMallocThreadInit rpmalloc_thread_init;
|
|
||||||
ProducerWrapper token;
|
ProducerWrapper token;
|
||||||
GpuCtxWrapper gpuCtx;
|
GpuCtxWrapper gpuCtx;
|
||||||
# ifdef TRACY_ON_DEMAND
|
# ifdef TRACY_ON_DEMAND
|
||||||
@ -1005,7 +986,7 @@ TRACY_API void InitRPMallocThread()
|
|||||||
// 1a. But s_queue is needed for initialization of variables in point 2.
|
// 1a. But s_queue is needed for initialization of variables in point 2.
|
||||||
extern moodycamel::ConcurrentQueue<QueueItem> s_queue;
|
extern moodycamel::ConcurrentQueue<QueueItem> s_queue;
|
||||||
|
|
||||||
thread_local RPMallocThreadInit init_order(106) s_rpmalloc_thread_init;
|
thread_local RPMallocInit init_order(106) s_rpmalloc_thread_init;
|
||||||
|
|
||||||
// 2. If these variables would be in the .CRT$XCB section, they would be initialized only in main thread.
|
// 2. If these variables would be in the .CRT$XCB section, they would be initialized only in main thread.
|
||||||
thread_local moodycamel::ProducerToken init_order(107) s_token_detail( s_queue );
|
thread_local moodycamel::ProducerToken init_order(107) s_token_detail( s_queue );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user