Files
AronaCore/core/misc/platform_thread.h
Nanako 6a7e99a3f8 修复退出时taskflow线程安全导致的崩溃
移除Tracy, 因为其导致线程安全问题崩溃
2024-05-26 00:17:38 +08:00

21 lines
487 B
C++

#include <iostream>
#include <thread>
#if PLATFORM_WINDOWS
#include <windows.h>
#include <processthreadsapi.h>
#elif PLATFORM_LINUX
#include <pthread.h>
#elif PLATFORM_MACOS
#include <pthread.h>
#endif
void set_thread_name(const char* name) {
#if PLATFORM_WINDOWS
SetThreadDescription(GetCurrentThread(), std::wstring(name, name + strlen(name)).c_str());
#elif PLATFORM_LINUX
pthread_setname_np(pthread_self(), name);
#elif PLATFORM_MACOS
pthread_setname_np(name);
#endif
}