folly: Singleton: update doc to match new Strict vs Relaxed types
authorLucian Grijincu <lucian@fb.com>
Tue, 6 Oct 2015 19:40:23 +0000 (12:40 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Tue, 6 Oct 2015 20:20:18 +0000 (13:20 -0700)
Summary: smallandbroken

Reviewed By: @fugalh

Differential Revision: D2509021

fb-gh-sync-id: 5e379b82615117df89cbc12943fdbe92511c067e

folly/Singleton.h

index 1d8ffa2749ccb67eec936e0c3c8665b1c424c09b..f3569594741d91f2633dd11afe10aca1cf6cba11 100644 (file)
@@ -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) {}