diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index 76aacf6d..735f6014 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -330,7 +330,11 @@ inline size_t _thread_id() long tid; thr_self(&tid); return static_cast(tid); -#else //Default to standard C++11 (OSX and other Unix) +#elif __APPLE__ + uint64_t tid; + pthread_threadid_np(nullptr, &tid); + return static_cast(tid); +#else //Default to standard C++11 (other Unix) return static_cast(std::hash()(std::this_thread::get_id())); #endif }