aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-chainstate.cpp
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2023-11-27 17:15:11 +0100
committerTheCharlatan <seb.kung@gmail.com>2024-02-16 17:12:52 +0100
commitd5228efb5391b31a9a0673019e43e7fa2cd4ac07 (patch)
tree300d36fe4b3143c435d36d2e6d617bd714ac0b00 /src/bitcoin-chainstate.cpp
parent06069b3913dda048f5d640a662b0852f86346ace (diff)
downloadbitcoin-d5228efb5391b31a9a0673019e43e7fa2cd4ac07.tar.xz
kernel: Remove dependency on CScheduler
By defining a virtual interface class for the scheduler client, users of the kernel can now define their own event consuming infrastructure, without having to spawn threads or rely on the scheduler design. Removing CScheduler also allows removing the thread and exception modules from the kernel library.
Diffstat (limited to 'src/bitcoin-chainstate.cpp')
-rw-r--r--src/bitcoin-chainstate.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp
index c4ff4f8ff7..3eb64aa344 100644
--- a/src/bitcoin-chainstate.cpp
+++ b/src/bitcoin-chainstate.cpp
@@ -23,11 +23,10 @@
#include <node/caches.h>
#include <node/chainstate.h>
#include <random.h>
-#include <scheduler.h>
#include <script/sigcache.h>
#include <util/chaintype.h>
#include <util/fs.h>
-#include <util/thread.h>
+#include <util/task_runner.h>
#include <validation.h>
#include <validationinterface.h>
@@ -68,16 +67,7 @@ int main(int argc, char* argv[])
Assert(InitSignatureCache(validation_cache_sizes.signature_cache_bytes));
Assert(InitScriptExecutionCache(validation_cache_sizes.script_execution_cache_bytes));
-
- // SETUP: Scheduling and Background Signals
- CScheduler scheduler{};
- // Start the lightweight task scheduler thread
- scheduler.m_service_thread = std::thread(util::TraceThread, "scheduler", [&] { scheduler.serviceQueue(); });
-
- ValidationSignals validation_signals{scheduler};
-
- // Gather some entropy once per minute.
- scheduler.scheduleEvery(RandAddPeriodic, std::chrono::minutes{1});
+ ValidationSignals validation_signals{std::make_unique<util::ImmediateTaskRunner>()};
class KernelNotifications : public kernel::Notifications
{
@@ -288,7 +278,6 @@ int main(int argc, char* argv[])
epilogue:
// Without this precise shutdown sequence, there will be a lot of nullptr
// dereferencing and UB.
- scheduler.stop();
if (chainman.m_thread_load.joinable()) chainman.m_thread_load.join();
validation_signals.FlushBackgroundCallbacks();