MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetThreadHandleImpl

Function GetThreadHandleImpl

Source/ThirdParty/tracy/common/TracySystem.cpp:72–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70{
71
72TRACY_API uint32_t GetThreadHandleImpl()
73{
74#if defined _WIN32
75 static_assert( sizeof( decltype( GetCurrentThreadId() ) ) <= sizeof( uint32_t ), "Thread handle too big to fit in protocol" );
76 return uint32_t( GetCurrentThreadId() );
77#elif defined __APPLE__
78 uint64_t id;
79 pthread_threadid_np( pthread_self(), &id );
80 return uint32_t( id );
81#elif defined __ANDROID__
82 return (uint32_t)gettid();
83#elif defined __linux__
84 return (uint32_t)syscall( SYS_gettid );
85#elif defined __FreeBSD__
86 long id;
87 thr_self( &id );
88 return id;
89#elif defined __NetBSD__
90 return _lwp_self();
91#elif defined __DragonFly__
92 return lwp_gettid();
93#elif defined __OpenBSD__
94 return getthrid();
95#elif defined __QNX__
96 return (uint32_t) gettid();
97#elif defined __EMSCRIPTEN__
98 // Not supported, but let it compile.
99 return 0;
100#else
101 // To add support for a platform, retrieve and return the kernel thread identifier here.
102 //
103 // Note that pthread_t (as for example returned by pthread_self()) is *not* a kernel
104 // thread identifier. It is a pointer to a library-allocated data structure instead.
105 // Such pointers will be reused heavily, making the pthread_t non-unique. Additionally
106 // a 64-bit pointer cannot be reliably truncated to 32 bits.
107 return Platform::GetCurrentThreadID();
108#endif
109
110}
111
112}
113

Callers 6

ProducerTokenMethod · 0.85
GetThreadHandleFunction · 0.85
TracyProfiler.cppFile · 0.85
ProfilerMethod · 0.85
GetThreadHandleFunction · 0.85
SetThreadNameWithHintFunction · 0.85

Calls 1

GetCurrentThreadIDFunction · 0.50

Tested by

no test coverage detected