Schedule destroyInstances in registrationComplete
authorAndrii Grynenko <andrii@fb.com>
Tue, 21 Oct 2014 20:55:56 +0000 (13:55 -0700)
committerdcsommer <dcsommer@fb.com>
Wed, 29 Oct 2014 23:04:14 +0000 (16:04 -0700)
Summary: This makes it more likely that SingletonVaultDestructor won't be created after atexit calls.

Test Plan: unit test

Reviewed By: chip@fb.com

Subscribers: hphp-diffs@, ps, njormrod, folly-diffs@

FB internal diff: D1629804

Tasks: 5353022

folly/experimental/Singleton.h

index 1d6c9a78c83397bee0216bf61870986cbab2ea29..ff0ef56faa7a5bc643f677e964fdc493dca717dd 100644 (file)
@@ -208,6 +208,8 @@ class SingletonVault {
   // Mark registration is complete; no more singletons can be
   // registered at this point.
   void registrationComplete() {
+    scheduleDestroyInstances();
+
     RWSpinLock::WriteHolder wh(&stateMutex_);
 
     stateCheck(SingletonVaultState::Running);