diff --git a/common/TracySystem.hpp b/common/TracySystem.hpp index 6cdc7fe2..1d48d9ca 100644 --- a/common/TracySystem.hpp +++ b/common/TracySystem.hpp @@ -15,6 +15,13 @@ extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(void # include #endif +#ifdef __ANDROID__ +# include +#elif defined __linux__ +# include +# include +#endif + #include #include @@ -34,6 +41,10 @@ static inline uint64_t GetThreadHandleImpl() uint64_t id; pthread_threadid_np( pthread_self(), &id ); return id; +#elif defined __ANDROID__ + return (uint64_t)gettid(); +#elif defined __linux__ + return (uint64_t)syscall( SYS_gettid ); #else static_assert( sizeof( decltype( pthread_self() ) ) <= sizeof( uint64_t ), "Thread handle too big to fit in protocol" ); return uint64_t( pthread_self() );