From: Bartosz Nitka Date: Fri, 5 Dec 2014 13:30:32 +0000 (-0800) Subject: Revert "Make folly::Singleton's destruction happen earlier" X-Git-Tag: v0.22.0~133 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4399c9e484cbbf54f710b62f3654148279f68586;p=folly.git 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 --- 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: