From 4780a106b3d4478b4f24d03b272790cfc696e7d3 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Mon, 27 Nov 2023 22:23:36 +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 | 29 +++++++++++++++++---------- src/bitcoind.cpp | 3 ++- src/node/interfaces.cpp | 3 ++- src/scheduler.h | 9 +++++---- src/test/util/setup_common.cpp | 2 +- src/util/task_queue_interface.h | 35 +++++++++++++++++++++++++++++++++ src/validationinterface.cpp | 15 +++++++------- src/validationinterface.h | 7 ++++--- 9 files changed, 76 insertions(+), 31 deletions(-) create mode 100644 src/util/task_queue_interface.h diff --git a/src/Makefile.am b/src/Makefile.am index b6f0daaabadbdd..e1e143b5dd394e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -321,6 +321,7 @@ BITCOIN_CORE_H = \ util/spanparsing.h \ util/string.h \ util/syserror.h \ + util/task_queue_interface.h \ util/thread.h \ util/threadinterrupt.h \ util/threadnames.h \ @@ -960,7 +961,6 @@ libbitcoinkernel_la_SOURCES = \ pubkey.cpp \ random.cpp \ randomenv.cpp \ - scheduler.cpp \ script/interpreter.cpp \ script/script.cpp \ script/script_error.cpp \ @@ -977,7 +977,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 \ @@ -988,7 +987,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 7d972325fb3d1b..609c316571e395 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -23,11 +23,10 @@ #include #include #include -#include #include