From 692a54ea74a65d9d6e1cb4adeeba618af9451aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 19 Jun 2021 14:54:36 +0200 Subject: [PATCH] An attempt at cleaning up the checks in ThreadUtil --- Common/Thread/ThreadUtil.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Common/Thread/ThreadUtil.cpp b/Common/Thread/ThreadUtil.cpp index 795647ff32..3b4137ea99 100644 --- a/Common/Thread/ThreadUtil.cpp +++ b/Common/Thread/ThreadUtil.cpp @@ -1,13 +1,19 @@ #include "ppsspp_config.h" -#ifdef _WIN32 +#if PPSSPP_PLATFORM(WINDOWS) + #include + #ifdef __MINGW32__ #include #endif + #define TLS_SUPPORTED + #elif defined(__ANDROID__) + #define TLS_SUPPORTED + #endif #include @@ -16,7 +22,11 @@ #include "Common/Log.h" #include "Common/Thread/ThreadUtil.h" -#if defined(__ANDROID__) || defined(__APPLE__) || (defined(__GLIBC__) && defined(_GNU_SOURCE)) +#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(LINUX) +#define _GNU_SOURCE +#endif + +#if !PPSSPP_PLATFORM(WINDOWS) #include #include #include @@ -105,12 +115,10 @@ void SetCurrentThreadName(const char* threadName) { {} #else -#if defined(__ANDROID__) || (defined(__GLIBC__) && defined(_GNU_SOURCE)) +#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(LINUX) pthread_setname_np(pthread_self(), threadName); #elif defined(__APPLE__) pthread_setname_np(threadName); -// #else -// pthread_setname_np(threadName); #endif // Do nothing @@ -140,7 +148,9 @@ int GetCurrentThreadIdForDebug() { uint64_t tid = 0; pthread_threadid_np(NULL, &tid); return (int)tid; -#else +#elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(LINUX) return (int)gettid(); +#else + return 1; #endif }