From 05fbb13d62ad73cbb542029940c9021afecb7bf1 Mon Sep 17 00:00:00 2001 From: Andrii Grynenko Date: Tue, 21 Oct 2014 13:55:56 -0700 Subject: [PATCH] Schedule destroyInstances in registrationComplete 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/folly/experimental/Singleton.h b/folly/experimental/Singleton.h index 1d6c9a78..ff0ef56f 100644 --- a/folly/experimental/Singleton.h +++ b/folly/experimental/Singleton.h @@ -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); -- 2.34.1