From d5228efb5391b31a9a0673019e43e7fa2cd4ac07 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Mon, 27 Nov 2023 17:15:11 +0100 Subject: [PATCH] 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. --- src/Makefile.am | 4 +-- src/bitcoin-chainstate.cpp | 15 ++-------- src/init.cpp | 2 +- src/scheduler.h | 13 ++++++--- src/test/util/setup_common.cpp | 2 +- src/util/task_runner.h | 52 ++++++++++++++++++++++++++++++++++ src/validationinterface.cpp | 24 +++++++--------- src/validationinterface.h | 10 +++++-- 8 files changed, 85 insertions(+), 37 deletions(-) create mode 100644 src/util/task_runner.h diff --git a/src/Makefile.am b/src/Makefile.am index 3e8870c828..0de19af613 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -326,6 +326,7 @@ BITCOIN_CORE_H = \ util/spanparsing.h \ util/string.h \ util/syserror.h \ + util/task_runner.h \ util/thread.h \ util/threadinterrupt.h \ util/threadnames.h \ @@ -975,7 +976,6 @@ libbitcoinkernel_la_SOURCES = \ pubkey.cpp \ random.cpp \ randomenv.cpp \ - scheduler.cpp \ script/interpreter.cpp \ script/script.cpp \ script/script_error.cpp \ @@ -992,7 +992,6 @@ libbitcoinkernel_la_SOURCES = \ util/batchpriority.cpp \ util/chaintype.cpp \ util/check.cpp \ - util/exception.cpp \ util/fs.cpp \ util/fs_helpers.cpp \ util/hasher.cpp \ @@ -1003,7 +1002,6 @@ libbitcoinkernel_la_SOURCES = \ util/strencodings.cpp \ util/string.cpp \ util/syserror.cpp \ - util/thread.cpp \ util/threadnames.cpp \ util/time.cpp \ util/tokenpipe.cpp \ 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 #include #include -#include #include