aboutsummaryrefslogtreecommitdiff
path: root/src/validationinterface.cpp
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2017-01-19 16:49:22 -0500
committerMatt Corallo <git@bluematt.me>2017-07-07 11:33:18 -0400
commitcda1429d5bfee129a0d1f6f1c65962b30251bafb (patch)
tree5625a6b2d9e5fd5cfe23c453ebbd6e1f34f362a9 /src/validationinterface.cpp
parent3a19fed9db558a5f666d965b6f602f7faf74ab73 (diff)
Give CMainSignals a reference to the global scheduler
...so that it can run some signals in the background later
Diffstat (limited to 'src/validationinterface.cpp')
-rw-r--r--src/validationinterface.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp
index 7d0ab756e8..a17a08eee2 100644
--- a/src/validationinterface.cpp
+++ b/src/validationinterface.cpp
@@ -4,6 +4,8 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "validationinterface.h"
+#include "init.h"
+#include "scheduler.h"
#include <boost/signals2/signal.hpp>
@@ -17,6 +19,8 @@ struct MainSignalsInstance {
boost::signals2::signal<void (int64_t nBestBlockTime, CConnman* connman)> Broadcast;
boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
boost::signals2::signal<void (const CBlockIndex *, const std::shared_ptr<const CBlock>&)> NewPoWValidBlock;
+
+ CScheduler *m_scheduler = NULL;
};
static CMainSignals g_signals;
@@ -25,6 +29,15 @@ CMainSignals::CMainSignals() {
m_internals.reset(new MainSignalsInstance());
}
+void CMainSignals::RegisterBackgroundSignalScheduler(CScheduler& scheduler) {
+ assert(!m_internals->m_scheduler);
+ m_internals->m_scheduler = &scheduler;
+}
+
+void CMainSignals::UnregisterBackgroundSignalScheduler() {
+ m_internals->m_scheduler = NULL;
+}
+
CMainSignals& GetMainSignals()
{
return g_signals;