From 1e9d60cab6fe1b41ea813eaf7ba9efc62f6f34fd Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Sat, 22 Sep 2018 00:30:56 -0400 Subject: [PATCH 1/2] common/thread: remove unnecessary macro for thread_local we have bumped compiler version really high that all of them support this --- src/common/thread.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/common/thread.h b/src/common/thread.h index 4da3bd39c..84fc016d9 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -11,25 +11,6 @@ #include #include "common/common_types.h" -// Support for C++11's thread_local keyword was surprisingly spotty in compilers until very -// recently. Fortunately, thread local variables have been well supported for compilers for a while, -// but with semantics supporting only POD types, so we can use a few defines to get some amount of -// backwards compat support. -// WARNING: This only works correctly with POD types. -#if defined(__clang__) -#if !__has_feature(cxx_thread_local) -#define thread_local __thread -#endif -#elif defined(__GNUC__) -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) -#define thread_local __thread -#endif -#elif defined(_MSC_VER) -#if _MSC_VER < 1900 -#define thread_local __declspec(thread) -#endif -#endif - namespace Common { int CurrentThreadId(); From 1855fb3d88c3487861e7beddb222dc07fbff7853 Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Sat, 22 Sep 2018 00:32:19 -0400 Subject: [PATCH 2/2] common/thread: remove YieldCPU() simply use the standard library yield() --- src/common/thread.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/common/thread.h b/src/common/thread.h index 84fc016d9..cd818ffad 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -96,14 +96,6 @@ private: void SleepCurrentThread(int ms); void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms - -// Use this function during a spin-wait to make the current thread -// relax while another thread is working. This may be more efficient -// than using events because event functions use kernel calls. -inline void YieldCPU() { - std::this_thread::yield(); -} - void SetCurrentThreadName(const char* name); } // namespace Common