Commit 7c08a582 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook Github Bot

Avoid creating a loop in the ThreadEntryList in onThreadExit

Summary: Avoid creating a loop in the ThreadEntryList in onThreadExit

Reviewed By: djwatson

Differential Revision: D7632840

fbshipit-source-id: 409358aae16a8aed4ae654ebfeca994385b43a9e
parent 1c609e4e
...@@ -116,18 +116,24 @@ TEST(SingletonThreadLocalTest, AccessAfterFastPathDestruction) { ...@@ -116,18 +116,24 @@ TEST(SingletonThreadLocalTest, AccessAfterFastPathDestruction) {
EXPECT_EQ(6, counter); EXPECT_EQ(6, counter);
} }
TEST(ThreadLocal, TagDependencyTest) { TEST(ThreadLocal, DependencyTest) {
typedef folly::ThreadLocalPtr<int> Data;
struct mytag {}; struct mytag {};
typedef SingletonThreadLocal<int> SingletonInt; typedef SingletonThreadLocal<int> SingletonInt;
struct barstruct { struct barstruct {
~barstruct() { ~barstruct() {
SingletonInt::get()++; SingletonInt::get()++;
Data data;
data.reset(new int(0));
} }
}; };
typedef SingletonThreadLocal<barstruct, mytag> BarSingleton; typedef SingletonThreadLocal<barstruct, mytag> BarSingleton;
std::thread([&]() { std::thread([&]() {
Data data;
data.reset(new int(0));
SingletonInt::get(); SingletonInt::get();
BarSingleton::get(); BarSingleton::get();
}) })
......
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