2017-09-10 15:46:20 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
# include <windows.h>
|
|
|
|
#else
|
|
|
|
# include <pthread.h>
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "TracySystem.hpp"
|
|
|
|
|
|
|
|
namespace tracy
|
|
|
|
{
|
|
|
|
|
2017-09-10 18:02:40 +00:00
|
|
|
const char* PointerCheckA = "tracy";
|
|
|
|
|
2017-09-10 15:46:20 +00:00
|
|
|
void SetThreadName( std::thread& thread, const char* name )
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
2017-09-21 20:54:44 +00:00
|
|
|
wchar_t buf[256];
|
|
|
|
mbstowcs( buf, name, 256 );
|
|
|
|
SetThreadDescription( static_cast<HANDLE>( thread.native_handle() ), buf );
|
2017-09-10 15:46:20 +00:00
|
|
|
#else
|
|
|
|
pthread_setname_np( thread.native_handle(), name );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|