From: Andrii Grynenko Date: Tue, 21 Oct 2014 20:55:56 +0000 (-0700) Subject: Schedule destroyInstances in registrationComplete X-Git-Tag: v0.22.0~249 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=05fbb13d62ad73cbb542029940c9021afecb7bf1;p=folly.git 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 --- 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);