Make folly::getCurrentThreadId() return a thread ID on OSX
authorChristopher Dykes <cdykes@fb.com>
Fri, 14 Apr 2017 20:54:32 +0000 (13:54 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 14 Apr 2017 21:05:01 +0000 (14:05 -0700)
Summary: It was previously returning a pointer masquerading as a `uint64_t`.

Reviewed By: yfeldblum

Differential Revision: D4888325

fbshipit-source-id: 6cf6ed09f0e7a39a8a2f93d3fa14b06913c27805

folly/ThreadId.h

index 2a30ff784cc889195eeeba710d0e00424da564ef..6593b3f101efec722487deef6fb448be3f523c9b 100644 (file)
@@ -24,7 +24,9 @@
 namespace folly {
 
 inline uint64_t getCurrentThreadID() {
-#ifdef _WIN32
+#if __APPLE__
+  return uint64_t(pthread_mach_thread_np(pthread_self()));
+#elif _WIN32
   return uint64_t(GetCurrentThreadId());
 #else
   return uint64_t(pthread_self());