Use folly::getCurrentThreadId() in SSLContext
authorChristopher Dykes <cdykes@fb.com>
Fri, 14 Apr 2017 21:09:23 +0000 (14:09 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 14 Apr 2017 21:19:40 +0000 (14:19 -0700)
Summary: Rather than duplicating logic (and #ifdefs), just call the helper function instead.

Reviewed By: yfeldblum

Differential Revision: D4888362

fbshipit-source-id: f5096f6029cf05526aa74bd40235ac8014824789

folly/io/async/SSLContext.cpp

index 630b34d..5550cdb 100644 (file)
@@ -20,6 +20,7 @@
 #include <folly/Memory.h>
 #include <folly/Random.h>
 #include <folly/SpinLock.h>
+#include <folly/ThreadId.h>
 
 // ---------------------------------------------------------------------
 // SSLContext implementation
@@ -769,15 +770,7 @@ static void callbackLocking(int mode, int n, const char*, int) {
 }
 
 static unsigned long callbackThreadID() {
-  return static_cast<unsigned long>(
-#ifdef __APPLE__
-    pthread_mach_thread_np(pthread_self())
-#elif _MSC_VER
-    pthread_getw32threadid_np(pthread_self())
-#else
-    pthread_self()
-#endif
-  );
+  return static_cast<unsigned long>(folly::getCurrentThreadID());
 }
 
 static CRYPTO_dynlock_value* dyn_create(const char*, int) {