Commit 32e0fe56 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 0

Don't initialize kDestroyWaitTime in-class

Summary: MSVC doesn't like it when you try to initialize a static in-class non-primitive constexpr member. It was only used in one place, so stick the definition in that function instead.

Reviewed By: yfeldblum

Differential Revision: D3255178

fb-gh-sync-id: e4a862a2662c4f5376c19fc52827cb2953f01e52
fbshipit-source-id: e4a862a2662c4f5376c19fc52827cb2953f01e52
parent 7d3bbfee
......@@ -140,6 +140,7 @@ void SingletonHolder<T>::destroyInstance() {
state_ = SingletonHolderState::Dead;
instance_.reset();
if (destroy_baton_) {
constexpr std::chrono::seconds kDestroyWaitTime{5};
auto wait_result = destroy_baton_->timed_wait(
std::chrono::steady_clock::now() + kDestroyWaitTime);
if (!wait_result) {
......
......@@ -29,8 +29,6 @@ namespace folly {
namespace detail {
constexpr std::chrono::seconds SingletonHolderBase::kDestroyWaitTime;
[[noreturn]] void singletonWarnDoubleRegistrationAndAbort(
const TypeDescriptor& type) {
// Not using LOG(FATAL) or std::cerr because they may not be initialized yet.
......
......@@ -225,9 +225,6 @@ class SingletonHolderBase {
virtual void createInstance() = 0;
virtual bool creationStarted() = 0;
virtual void destroyInstance() = 0;
protected:
static constexpr std::chrono::seconds kDestroyWaitTime{5};
};
// An actual instance of a singleton, tracking the instance itself,
......
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