fbcode: remove unused includes from .cpp files without #if (but possibly #define)
[folly.git] / folly / test / ThreadCachedIntTest.cpp
index 1543bdaa11cb0966722bc83a3dfeadb940601dfd..aadefc98f0d726c07295d4c743e9bc93e65cb0e8 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <folly/Benchmark.h>
 #include <folly/Hash.h>
+#include <folly/ThreadId.h>
 #include <folly/portability/GFlags.h>
 #include <folly/portability/GTest.h>
 
@@ -298,9 +299,8 @@ struct ShardedAtomicInt {
   std::atomic<int64_t> ints_[kBuckets_];
 
   inline void inc(int64_t val = 1) {
-    int bucket = hash::twang_mix64(
-      uint64_t(pthread_self())) & (kBuckets_ - 1);
-    std::atomic_fetch_add(&ints_[bucket], val);
+    int buck = hash::twang_mix64(folly::getCurrentThreadID()) & (kBuckets_ - 1);
+    std::atomic_fetch_add(&ints_[buck], val);
   }
 
   // read the first few and extrapolate