1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

SetThreadName() only works on the current thread.

This breaking change is required, because kernel trace facilities use
kernel thread ids, which are inaccessible from the pthread_t level.
This commit is contained in:
Bartosz Taudul
2019-08-14 02:22:45 +02:00
parent 339b7fd2a6
commit 92b6da7cc2
6 changed files with 34 additions and 71 deletions
+3 -5
View File
@@ -7,7 +7,7 @@
# endif
#endif
#ifdef _WIN32
#if defined _WIN32 || defined __CYGWIN__
# ifndef _WINDOWS_
extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(void);
# endif
@@ -23,7 +23,6 @@ extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(void
#endif
#include <stdint.h>
#include <thread>
#include "TracyApi.h"
@@ -34,7 +33,7 @@ namespace detail
{
static inline uint64_t GetThreadHandleImpl()
{
#ifdef _WIN32
#if defined _WIN32 || defined __CYGWIN__
static_assert( sizeof( decltype( GetCurrentThreadId() ) ) <= sizeof( uint64_t ), "Thread handle too big to fit in protocol" );
return uint64_t( GetCurrentThreadId() );
#elif defined __APPLE__
@@ -61,8 +60,7 @@ static inline uint64_t GetThreadHandle()
}
#endif
void SetThreadName( std::thread& thread, const char* name );
void SetThreadName( std::thread::native_handle_type handle, const char* name );
void SetThreadName( const char* name );
const char* GetThreadName( uint64_t id );
}