From: Lucian Grijincu Date: Tue, 6 Oct 2015 19:40:23 +0000 (-0700) Subject: folly: Singleton: update doc to match new Strict vs Relaxed types X-Git-Tag: deprecate-dynamic-initializer~352 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7846391372cbc68f76ec985ca29fd8160ccae9ad;p=folly.git folly: Singleton: update doc to match new Strict vs Relaxed types Summary: smallandbroken Reviewed By: @fugalh Differential Revision: D2509021 fb-gh-sync-id: 5e379b82615117df89cbc12943fdbe92511c067e --- diff --git a/folly/Singleton.h b/folly/Singleton.h index 1d8ffa27..f3569594 100644 --- a/folly/Singleton.h +++ b/folly/Singleton.h @@ -144,8 +144,9 @@ namespace folly { // // A vault goes through a few stages of life: // -// 1. Registration phase; singletons can be registered, but no -// singleton can be created. +// 1. Registration phase; singletons can be registered: +// a) Strict: no singleton can be created in this stage. +// b) Relaxed: singleton can be created (the default vault is Relaxed). // 2. registrationComplete() has been called; singletons can no // longer be registered, but they can be created. // 3. A vault can return to stage 1 when destroyInstances is called. @@ -300,7 +301,10 @@ struct SingletonHolder : public SingletonHolderBase { class SingletonVault { public: - enum class Type { Strict, Relaxed }; + enum class Type { + Strict, // Singletons can't be created before registrationComplete() + Relaxed, // Singletons can be created before registrationComplete() + }; explicit SingletonVault(Type type = Type::Relaxed) : type_(type) {}