Commit acac120e authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 3

Use FOLLY_TLS rather than __thread

Summary: We define `FOLLY_TLS` for a reason, so use it.

Reviewed By: yfeldblum

Differential Revision: D3479880

fbshipit-source-id: 2aa11c2900cdb012cf96d4f084fe81a0428f53d3
parent 73e35f02
...@@ -156,7 +156,7 @@ TEST(IndexedMemPool, locate_elem) { ...@@ -156,7 +156,7 @@ TEST(IndexedMemPool, locate_elem) {
} }
struct NonTrivialStruct { struct NonTrivialStruct {
static __thread int count; static FOLLY_TLS int count;
int elem_; int elem_;
...@@ -175,7 +175,7 @@ struct NonTrivialStruct { ...@@ -175,7 +175,7 @@ struct NonTrivialStruct {
} }
}; };
__thread int NonTrivialStruct::count; FOLLY_TLS int NonTrivialStruct::count;
TEST(IndexedMemPool, eager_recycle) { TEST(IndexedMemPool, eager_recycle) {
typedef IndexedMemPool<NonTrivialStruct> Pool; typedef IndexedMemPool<NonTrivialStruct> Pool;
......
...@@ -118,7 +118,7 @@ void runElementTypeTest(T&& src) { ...@@ -118,7 +118,7 @@ void runElementTypeTest(T&& src) {
} }
struct RefCounted { struct RefCounted {
static __thread int active_instances; static FOLLY_TLS int active_instances;
mutable std::atomic<int> rc; mutable std::atomic<int> rc;
...@@ -130,8 +130,7 @@ struct RefCounted { ...@@ -130,8 +130,7 @@ struct RefCounted {
--active_instances; --active_instances;
} }
}; };
__thread int RefCounted::active_instances; FOLLY_TLS int RefCounted::active_instances;
void intrusive_ptr_add_ref(RefCounted const* p) { void intrusive_ptr_add_ref(RefCounted const* p) {
p->rc++; p->rc++;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <thread> #include <thread>
__thread long instance_counter_instances = 0; FOLLY_TLS long instance_counter_instances = 0;
class InstanceCounter { class InstanceCounter {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment