Don't re-create singletons
authorAndrii Grynenko <andrii@fb.com>
Wed, 8 Oct 2014 01:12:33 +0000 (18:12 -0700)
committerAndrii Grynenko <andrii@fb.com>
Wed, 15 Oct 2014 01:00:32 +0000 (18:00 -0700)
commitf321edf8a5e1d750e975ffe7e986aacc4d736253
treedea361b7b45e182f515127a0d0c70181bbac2341
parent4928fe780da82279573a672c10db48be6244da9f
Don't re-create singletons

Summary:
This forbids singleton creation/re-creation after destroyInstances() was called.
Only after reset() is called singletons can be created again.

registrationComplete() behavior is also slightly change. We disallow singleton registration after registrationComplete() is called even in Relaxed mode. Strict mode now only controlls whether singletons can be constructed before registation is complete.

Test Plan: unit test

Reviewed By: chip@fb.com

Subscribers: hphp-diffs@, ps, trunkagent, njormrod, mshneer, lins

FB internal diff: D1605136
folly/experimental/Singleton.cpp
folly/experimental/Singleton.h
folly/experimental/test/SingletonTest.cpp