tracy/common/TracySystem.cpp

28 lines
466 B
C++
Raw Normal View History

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
{
const char* PointerCheckA = "tracy";
2017-09-10 15:46:20 +00:00
void SetThreadName( std::thread& thread, const char* name )
{
#ifdef _WIN32
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
}
}