From 4399c9e484cbbf54f710b62f3654148279f68586 Mon Sep 17 00:00:00 2001 From: Bartosz Nitka Date: Fri, 5 Dec 2014 05:30:32 -0800 Subject: [PATCH] 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 --- folly/experimental/Singleton.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/folly/experimental/Singleton.h b/folly/experimental/Singleton.h index 20416015..c42daf01 100644 --- a/folly/experimental/Singleton.h +++ b/folly/experimental/Singleton.h @@ -208,7 +208,7 @@ class SingletonVault { // Mark registration is complete; no more singletons can be // registered at this point. void registrationComplete() { - std::atexit([](){ SingletonVault::singleton()->destroyInstances(); }); + scheduleDestroyInstances(); RWSpinLock::WriteHolder wh(&stateMutex_); @@ -329,9 +329,6 @@ class SingletonVault { 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. // Used to have better deletion ordering with singleton not managed by // folly::Singleton. The desruction will happen in the following order: -- 2.34.1