Use FOLLY_TLS rather than __thread
authorChristopher Dykes <cdykes@fb.com>
Fri, 24 Jun 2016 17:42:21 +0000 (10:42 -0700)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Fri, 24 Jun 2016 17:53:37 +0000 (10:53 -0700)
Summary: We define `FOLLY_TLS` for a reason, so use it.

Reviewed By: yfeldblum

Differential Revision: D3479880

fbshipit-source-id: 2aa11c2900cdb012cf96d4f084fe81a0428f53d3

folly/test/IndexedMemPoolTest.cpp
folly/test/MPMCQueueTest.cpp
folly/test/SingletonVaultCTest.cpp

index 91c248055d3a3e0d581a5f7d69c9ae75144010d8..03e24ee2aac5576c752acea07255f13300340a93 100644 (file)
@@ -156,7 +156,7 @@ TEST(IndexedMemPool, locate_elem) {
 }
 
 struct NonTrivialStruct {
-  static __thread int count;
+  static FOLLY_TLS int count;
 
   int elem_;
 
@@ -175,7 +175,7 @@ struct NonTrivialStruct {
   }
 };
 
-__thread int NonTrivialStruct::count;
+FOLLY_TLS int NonTrivialStruct::count;
 
 TEST(IndexedMemPool, eager_recycle) {
   typedef IndexedMemPool<NonTrivialStruct> Pool;
index 25b85a92a4ebff668c6743a5a942155b683f40ce..05ff5715bca7af3beeea667ebad8e2477d9d1445 100644 (file)
@@ -118,7 +118,7 @@ void runElementTypeTest(T&& src) {
 }
 
 struct RefCounted {
-  static __thread int active_instances;
+  static FOLLY_TLS int active_instances;
 
   mutable std::atomic<int> rc;
 
@@ -130,8 +130,7 @@ struct RefCounted {
     --active_instances;
   }
 };
-__thread int RefCounted::active_instances;
-
+FOLLY_TLS int RefCounted::active_instances;
 
 void intrusive_ptr_add_ref(RefCounted const* p) {
   p->rc++;
index 16877149bda1ccd9bd7435bb4ae9cc73e6a18340..00e9f5b9591afc8e0d428b973de891ff42382250 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <thread>
 
-__thread long instance_counter_instances = 0;
+FOLLY_TLS long instance_counter_instances = 0;
 
 class InstanceCounter {
  public: