Make folly::getCurrentThreadId() return a thread ID on OSX
[folly.git] / folly / ThreadId.h
index 06d4bb1402c90c7667a4a0a979856512fda6295c..6593b3f101efec722487deef6fb448be3f523c9b 100644 (file)
 #include <cstdint>
 
 #include <folly/portability/PThread.h>
+#include <folly/portability/Windows.h>
 
 namespace folly {
 
 inline uint64_t getCurrentThreadID() {
-#ifdef _WIN32
-  // There's no need to force a Windows.h include, so grab the ID
-  // via pthread instead.
-  return uint64_t(pthread_getw32threadid_np(pthread_self()));
+#if __APPLE__
+  return uint64_t(pthread_mach_thread_np(pthread_self()));
+#elif _WIN32
+  return uint64_t(GetCurrentThreadId());
 #else
   return uint64_t(pthread_self());
 #endif