mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Allow direct access to ThreadNameData.
This commit is contained in:
parent
3658c0c90f
commit
5e224101c4
@ -101,13 +101,6 @@ TRACY_API uint32_t GetThreadHandleImpl()
|
||||
}
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
struct ThreadNameData
|
||||
{
|
||||
uint32_t id;
|
||||
uint32_t groupHint;
|
||||
const char* name;
|
||||
ThreadNameData* next;
|
||||
};
|
||||
std::atomic<ThreadNameData*>& GetThreadNameData();
|
||||
#endif
|
||||
|
||||
@ -219,6 +212,22 @@ TRACY_API void SetThreadNameWithHint( const char* name, uint32_t groupHint )
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
ThreadNameData* GetThreadNameData( uint32_t id )
|
||||
{
|
||||
auto ptr = GetThreadNameData().load( std::memory_order_relaxed );
|
||||
while( ptr )
|
||||
{
|
||||
if( ptr->id == id )
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACY_API const char* GetThreadName( uint32_t id )
|
||||
{
|
||||
static char buf[256];
|
||||
|
@ -14,6 +14,16 @@ TRACY_API uint32_t GetThreadHandleImpl();
|
||||
}
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
struct ThreadNameData
|
||||
{
|
||||
uint32_t id;
|
||||
uint32_t groupHint;
|
||||
const char* name;
|
||||
ThreadNameData* next;
|
||||
};
|
||||
|
||||
ThreadNameData* GetThreadNameData( uint32_t id );
|
||||
|
||||
TRACY_API uint32_t GetThreadHandle();
|
||||
#else
|
||||
static inline uint32_t GetThreadHandle()
|
||||
|
Loading…
Reference in New Issue
Block a user