tracy/common/TracySystem.cpp
Bartosz Taudul 0c0b18615a Use winapi function to set thread name.
Fairly recent Windows SDK is required, unfortunately.
2017-09-21 22:54:44 +02:00

28 lines
466 B
C++
Executable File

#ifdef _WIN32
# include <windows.h>
#else
# include <pthread.h>
# include <unistd.h>
#endif
#include "TracySystem.hpp"
namespace tracy
{
const char* PointerCheckA = "tracy";
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 );
#else
pthread_setname_np( thread.native_handle(), name );
#endif
}
}