Commit 4399c9e4 authored by Bartosz Nitka's avatar Bartosz Nitka Committed by Dave Watson

Revert "Make folly::Singleton's destruction happen earlier"

Summary: This reverts commit 6584412293cc5b9aad2004e99d550e3478df1e5d.

Test Plan: thisisrevert

Reviewed By: smarlow@fb.com

Subscribers: njormrod, folly-diffs@

FB internal diff: D1721739

Signature: t1:1721739:1417786147:01aaaf50b679da7942b2a30ad039eb0ac1031430
parent 8f9cc411
...@@ -208,7 +208,7 @@ class SingletonVault { ...@@ -208,7 +208,7 @@ class SingletonVault {
// Mark registration is complete; no more singletons can be // Mark registration is complete; no more singletons can be
// registered at this point. // registered at this point.
void registrationComplete() { void registrationComplete() {
std::atexit([](){ SingletonVault::singleton()->destroyInstances(); }); scheduleDestroyInstances();
RWSpinLock::WriteHolder wh(&stateMutex_); RWSpinLock::WriteHolder wh(&stateMutex_);
...@@ -329,9 +329,6 @@ class SingletonVault { ...@@ -329,9 +329,6 @@ class SingletonVault {
SingletonEntry(SingletonEntry&&) = delete; SingletonEntry(SingletonEntry&&) = delete;
}; };
// This method only matters if registrationComplete() is never called.
// Otherwise destroyInstances is scheduled to be executed atexit.
//
// Initializes static object, which calls destroyInstances on destruction. // Initializes static object, which calls destroyInstances on destruction.
// Used to have better deletion ordering with singleton not managed by // Used to have better deletion ordering with singleton not managed by
// folly::Singleton. The desruction will happen in the following order: // folly::Singleton. The desruction will happen in the following order:
......
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