Support folly::getCurrentThreadID() without PThread
authorChristopher Dykes <cdykes@fb.com>
Fri, 14 Apr 2017 01:52:20 +0000 (18:52 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 14 Apr 2017 01:52:55 +0000 (18:52 -0700)
Summary: Just use the native Windows API call instead, as it gives the same result.

Reviewed By: yfeldblum

Differential Revision: D4887587

fbshipit-source-id: adbfd288bea425f1aff46d0685083807490f7f09

folly/ThreadId.h

index 06d4bb1402c90c7667a4a0a979856512fda6295c..2a30ff784cc889195eeeba710d0e00424da564ef 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()));
+  return uint64_t(GetCurrentThreadId());
 #else
   return uint64_t(pthread_self());
 #endif