mirror of https://github.com/facebook/rocksdb.git
Turn the default Timer in PeriodicTaskScheduler into a leaky Meyers singleton (#12128)
Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/12128 The patch turns the `Timer` Meyers singleton in `PeriodicTaskScheduler::Default()` into one of the leaky variety in order to prevent static destruction order issues. Reviewed By: akankshamahajan15 Differential Revision: D51963950 fbshipit-source-id: 0fc34113ad03c51fdc83bdb8c2cfb6c9f6913948
This commit is contained in:
parent
179d2c7646
commit
a143f93236
|
@ -94,7 +94,7 @@ Status PeriodicTaskScheduler::Unregister(PeriodicTaskType task_type) {
|
|||
}
|
||||
|
||||
Timer* PeriodicTaskScheduler::Default() {
|
||||
static Timer timer(SystemClock::Default().get());
|
||||
STATIC_AVOID_DESTRUCTION(Timer, timer)(SystemClock::Default().get());
|
||||
return &timer;
|
||||
}
|
||||
|
||||
|
@ -108,4 +108,3 @@ void PeriodicTaskScheduler::TEST_OverrideTimer(SystemClock* clock) {
|
|||
#endif // NDEBUG
|
||||
|
||||
} // namespace ROCKSDB_NAMESPACE
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Avoid destroying the periodic task scheduler's default timer in order to prevent static destruction order issues.
|
Loading…
Reference in New Issue