diff --git a/common/TracySystem.hpp b/common/TracySystem.hpp index 7f6424ef..85b107fd 100644 --- a/common/TracySystem.hpp +++ b/common/TracySystem.hpp @@ -16,6 +16,12 @@ extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(void # else # include # endif +#elif defined __FreeBSD__ +# include +#elif defined __NetBSD__ || defined __DragonFly__ +# include +#elif defined __OpenBSD__ +# include #endif #include @@ -40,6 +46,16 @@ static inline uint64_t GetThreadHandleImpl() return (uint64_t)gettid(); #elif defined __linux__ return (uint64_t)syscall( SYS_gettid ); +#elif defined __FreeBSD__ + long id; + thr_self( &id ); + return id; +#elif defined __NetBSD__ + return _lwp_self(); +#elif defined __DragonFly__ + return lwp_gettid(); +#elif defined __OpenBSD__ + return getthrid(); #else static_assert( sizeof( decltype( pthread_self() ) ) <= sizeof( uint64_t ), "Thread handle too big to fit in protocol" ); return uint64_t( pthread_self() );