Try again: folly::Singleton, a class for managing singletons
Summary:
Singletons are surprisingly tricky in a codebase where
libraries depend on one another. folly::Singleton hopes to make this
process more reliable by ensuring object creation happens in a safe
order, that destruction is possible, and that singletons are created
on-demand.
The basic fbcode use intention is to invoke registration completion in
initFacebook, so users need only declare singletons via
Singleton<ClassName> in their .cpp files.
This diff ties the Singletons into the core Init process, but not hhvm
(which will be a separate diff).
Test Plan: runtests
Reviewed By: joelm@fb.com, hans@fb.com
Subscribers: fbcode-common-diffs@, hphp-diffs@, soren, anca, lins, aalexandre, ps, trunkagent, lucian, hannesr, yfeldblum, maxwellsayles
FB internal diff:
D1453135