Add indicators of process phases
Summary: Add function `get_process_phase` that returns indicators of process phases: - `ProcessPhase::Init`: Not all global variables may have been initialized. - `ProcessPhase::Regular`: All globals have been initialized and have not been destroyed. - `ProcessPhase::Exit`: Some globals may have been destroyed. Add function `set_process_phases` and calls to it from `folly::init` and `common/init/Init.cpp` wherever `SingletonVault::singleton()->registrationComplete` is called. Will add calls to `set_process_phases` in separate diffs to other places that call `registrationComplete ` directly. See Section 6.9.3 Start and termination [basic.start] of the C++ Standard Working Draft [N4849](https://github.com/cplusplus/draft/releases/download/n4849/n4849.pdf). In general this addition is useful for simplifying cases of dependence on the existence of certain globals during main, where it is safe to ignore such globals at shutdown. For example, the destructor of `hazptr_obj_cohort` normally needs to access the default `hazptr_domain`, but it is safe to skip that access at shutdown. Reviewed By: yfeldblum Differential Revision: D19567170 fbshipit-source-id: a44cbd3301aa9dc77a1e992922403635a3ff6552
Showing
folly/init/Phase.cpp
0 → 100644
folly/init/Phase.h
0 → 100644
Please register or sign in to comment