Avoid glog when warning about Singleton double-registration
authorYedidya Feldblum <yfeldblum@fb.com>
Mon, 2 May 2016 09:26:07 +0000 (02:26 -0700)
committerFacebook Github Bot 8 <facebook-github-bot-8-bot@fb.com>
Mon, 2 May 2016 09:35:28 +0000 (02:35 -0700)
commit7dd60842ca7b3ca266db5dfcf31e99b3adbfbe17
tree749989b78ca267c3767512ac1d3d288cc30168b2
parentebc7dd0de112dba0d72d297400b031708ba8f970
Avoid glog when warning about Singleton double-registration

Summary:
[Folly] Avoid glog when warning about `Singleton` double-registration.

Because registration happens at static initialization time, long before main, and possibly long before glog is initialized.

This makes a difference because, in some cases of double-registration, we can get a SIGSEGV with no message, because we are attempting to `LOG(FATAL)` when glog is uninitialized. What we would much rather have is a SIGABRT with a message.

Reviewed By: meyering

Differential Revision: D3245047

fb-gh-sync-id: 4c5dd9d25025f197d7c490ffbb429af5ccb82182
fbshipit-source-id: 4c5dd9d25025f197d7c490ffbb429af5ccb82182
folly/Singleton-inl.h
folly/Singleton.cpp
folly/test/SingletonDoubleRegistration.cpp [new file with mode: 0644]
folly/test/SingletonTest.cpp