diff --git a/public/common/TracySystem.cpp b/public/common/TracySystem.cpp index 48dd42b7..2e1ba21f 100644 --- a/public/common/TracySystem.cpp +++ b/public/common/TracySystem.cpp @@ -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& 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]; diff --git a/public/common/TracySystem.hpp b/public/common/TracySystem.hpp index 5f1e64ec..22203f9f 100644 --- a/public/common/TracySystem.hpp +++ b/public/common/TracySystem.hpp @@ -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()