Revert "Make folly::Singleton's destruction happen earlier"
authorBartosz Nitka <bnitka@fb.com>
Fri, 5 Dec 2014 13:30:32 +0000 (05:30 -0800)
committerDave Watson <davejwatson@fb.com>
Thu, 11 Dec 2014 16:00:43 +0000 (08:00 -0800)
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

index 20416015883eceffdade7e6f4d76444f61419b98..c42daf01f075d7fa2d9ebac1f30e5ac4510833bf 100644 (file)
@@ -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: