From 3192975f1d177aa9f0bbd823c6387cfbfa943610 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 27 Jun 2017 19:07:52 -0400 Subject: Flush CValidationInterface callbacks prior to destruction Note that the CScheduler thread cant be running at this point, it has already been stopped with the rest of the init threadgroup. Thus, just calling any remaining loose callbacks during Shutdown() is sane. --- src/scheduler.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/scheduler.cpp') diff --git a/src/scheduler.cpp b/src/scheduler.cpp index a76a87e10a..35bf0da4be 100644 --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -191,3 +191,12 @@ void SingleThreadedSchedulerClient::AddToProcessQueue(std::function } MaybeScheduleProcessQueue(); } + +void SingleThreadedSchedulerClient::EmptyQueue() { + bool should_continue = true; + while (should_continue) { + ProcessQueue(); + LOCK(m_cs_callbacks_pending); + should_continue = !m_callbacks_pending.empty(); + } +} -- cgit v1.2.3