From acac120eeef384a6ce8b071f132fe64229eba260 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Fri, 24 Jun 2016 10:42:21 -0700 Subject: [PATCH] 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 --- folly/test/IndexedMemPoolTest.cpp | 4 ++-- folly/test/MPMCQueueTest.cpp | 5 ++--- folly/test/SingletonVaultCTest.cpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/folly/test/IndexedMemPoolTest.cpp b/folly/test/IndexedMemPoolTest.cpp index 91c24805..03e24ee2 100644 --- a/folly/test/IndexedMemPoolTest.cpp +++ b/folly/test/IndexedMemPoolTest.cpp @@ -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 Pool; diff --git a/folly/test/MPMCQueueTest.cpp b/folly/test/MPMCQueueTest.cpp index 25b85a92..05ff5715 100644 --- a/folly/test/MPMCQueueTest.cpp +++ b/folly/test/MPMCQueueTest.cpp @@ -118,7 +118,7 @@ void runElementTypeTest(T&& src) { } struct RefCounted { - static __thread int active_instances; + static FOLLY_TLS int active_instances; mutable std::atomic 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++; diff --git a/folly/test/SingletonVaultCTest.cpp b/folly/test/SingletonVaultCTest.cpp index 16877149..00e9f5b9 100644 --- a/folly/test/SingletonVaultCTest.cpp +++ b/folly/test/SingletonVaultCTest.cpp @@ -21,7 +21,7 @@ #include -__thread long instance_counter_instances = 0; +FOLLY_TLS long instance_counter_instances = 0; class InstanceCounter { public: -- 2.34.1