Commit 96e52d24 authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Dave Watson

Revert "Revert "Make folly::Singleton's destruction happen earlier""

Summary:
This reverts commit 7871df125fc1fbe5d8030a41e21b8241b25d4e62.

As explained in t5763478, I don't see good reason for a revert.
Also the errors under question shouldn't show up after D1720841.

Test Plan: revert-hammer

Reviewed By: stepan@fb.com

Subscribers: njormrod, folly-diffs@

FB internal diff: D1722928

Tasks: 5763478

Signature: t1:1722928:1417818663:1fe402d14c0cf389fb3611355db270c5f2c33738
parent cb3f8bf3
......@@ -208,7 +208,7 @@ class SingletonVault {
// Mark registration is complete; no more singletons can be
// registered at this point.
void registrationComplete() {
scheduleDestroyInstances();
std::atexit([](){ SingletonVault::singleton()->destroyInstances(); });
RWSpinLock::WriteHolder wh(&stateMutex_);
......@@ -329,6 +329,9 @@ class SingletonVault {
SingletonEntry(SingletonEntry&&) = delete;
};
// This method only matters if registrationComplete() is never called.
// Otherwise destroyInstances is scheduled to be executed atexit.
//
// Initializes static object, which calls destroyInstances on destruction.
// Used to have better deletion ordering with singleton not managed by
// folly::Singleton. The desruction will happen in the following order:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment