Commit 8a0fc92f authored by gabime's avatar gabime

Replaced SPDLOG_DISABLE_TID_CACHING with SPDLOG_NO_TLS

parent 4a34cd06
...@@ -338,8 +338,7 @@ inline size_t _thread_id() SPDLOG_NOEXCEPT ...@@ -338,8 +338,7 @@ inline size_t _thread_id() SPDLOG_NOEXCEPT
// Return current thread id as size_t (from thread local storage) // Return current thread id as size_t (from thread local storage)
inline size_t thread_id() SPDLOG_NOEXCEPT inline size_t thread_id() SPDLOG_NOEXCEPT
{ {
#if defined(SPDLOG_DISABLE_TID_CACHING) || (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt) || \ #if defined(SPDLOG_NO_TLS)
(defined(__clang__) && !__has_feature(cxx_thread_local))
return _thread_id(); return _thread_id();
#else // cache thread id in tls #else // cache thread id in tls
static thread_local const size_t tid = _thread_id(); static thread_local const size_t tid = _thread_id();
...@@ -384,6 +383,7 @@ inline int pid() ...@@ -384,6 +383,7 @@ inline int pid()
#endif #endif
} }
// Determine if the terminal supports colors // Determine if the terminal supports colors
// Source: https://github.com/agauniyal/rang/ // Source: https://github.com/agauniyal/rang/
inline bool is_color_terminal() SPDLOG_NOEXCEPT inline bool is_color_terminal() SPDLOG_NOEXCEPT
......
...@@ -45,13 +45,12 @@ ...@@ -45,13 +45,12 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Uncomment to prevent spdlog from caching thread ids in thread local storage. // Uncomment to prevent spdlog from using thread local storage.
// By default spdlog saves thread ids in tls to gain a few micros for each call.
// //
// WARNING: if your program forks, UNCOMMENT this flag to prevent undefined // WARNING: if your program forks, UNCOMMENT this flag to prevent undefined
// thread ids in the children logs. // thread ids in the children logs.
// //
// #define SPDLOG_DISABLE_TID_CACHING // #define SPDLOG_NO_TLS
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment