mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
GetThreadHandle() might be used by application's code.
This commit is contained in:
parent
0b656c3469
commit
bc7f2c49c8
@ -928,7 +928,7 @@ enum { BulkSize = TargetFrameSize / QueueItemSize };
|
|||||||
|
|
||||||
Profiler::Profiler()
|
Profiler::Profiler()
|
||||||
: m_timeBegin( 0 )
|
: m_timeBegin( 0 )
|
||||||
, m_mainThread( GetThreadHandleImpl() )
|
, m_mainThread( detail::GetThreadHandleImpl() )
|
||||||
, m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() )
|
, m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() )
|
||||||
, m_shutdown( false )
|
, m_shutdown( false )
|
||||||
, m_shutdownManual( false )
|
, m_shutdownManual( false )
|
||||||
|
@ -23,7 +23,8 @@ extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(void
|
|||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef TRACY_ENABLE
|
namespace detail
|
||||||
|
{
|
||||||
static inline uint64_t GetThreadHandleImpl()
|
static inline uint64_t GetThreadHandleImpl()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -38,13 +39,20 @@ static inline uint64_t GetThreadHandleImpl()
|
|||||||
return uint64_t( pthread_self() );
|
return uint64_t( pthread_self() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const thread_local auto s_threadHandle = GetThreadHandleImpl();
|
#ifdef TRACY_ENABLE
|
||||||
|
const thread_local auto s_threadHandle = detail::GetThreadHandleImpl();
|
||||||
|
|
||||||
static inline uint64_t GetThreadHandle()
|
static inline uint64_t GetThreadHandle()
|
||||||
{
|
{
|
||||||
return s_threadHandle;
|
return s_threadHandle;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static inline uint64_t GetThreadHandle()
|
||||||
|
{
|
||||||
|
return detail::GetThreadHandleImpl();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SetThreadName( std::thread& thread, const char* name );
|
void SetThreadName( std::thread& thread, const char* name );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user