/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <folly/Singleton.h>
#include <folly/SingletonVault_c.h>
-#include <gtest/gtest.h>
+#include <folly/portability/GTest.h>
-#include <thread>
-
-__thread long instance_counter_instances = 0;
+FOLLY_TLS long instance_counter_instances = 0;
class InstanceCounter {
public:
auto vault = folly::SingletonVault::singleton<TestTag>();
SingletonTest<InstanceCounter> counter_singleton;
SingletonVault_registrationComplete((SingletonVault_t*) vault);
- InstanceCounter *counter = SingletonTest<InstanceCounter>::get();
+ SingletonTest<InstanceCounter>::try_get();
EXPECT_EQ(instance_counter_instances, 1);
SingletonVault_destroyInstances((SingletonVault_t*) vault);
EXPECT_EQ(instance_counter_instances, 0);