From f9758d7b183d589a071e608b1cd77e2220fd9cef 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 | 7 +++--- src/bitcoin-chainstate.cpp | 16 +++----------- 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 | 39 +++++++++++++++++++++++++++++++++ src/validationinterface.cpp | 15 ++++++------- src/validationinterface.h | 7 +++--- 9 files changed, 67 insertions(+), 34 deletions(-) create mode 100644 src/util/task_queue_interface.h diff --git a/src/Makefile.am b/src/Makefile.am index b6f0daaabadbdd..c3e60d2067b425 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -306,6 +306,7 @@ BITCOIN_CORE_H = \ util/golombrice.h \ util/hash_type.h \ util/hasher.h \ + util/immediate_task_queue.h \ util/insert.h \ util/macros.h \ util/message.h \ @@ -321,6 +322,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 \ @@ -739,6 +741,7 @@ libbitcoin_util_a_SOURCES = \ util/fs.cpp \ util/fs_helpers.cpp \ util/hasher.cpp \ + util/immediate_task_queue.cpp \ util/sock.cpp \ util/syserror.cpp \ util/message.cpp \ @@ -960,7 +963,6 @@ libbitcoinkernel_la_SOURCES = \ pubkey.cpp \ random.cpp \ randomenv.cpp \ - scheduler.cpp \ script/interpreter.cpp \ script/script.cpp \ script/script_error.cpp \ @@ -977,10 +979,10 @@ 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 \ + util/immediate_task_queue.cpp \ util/moneystr.cpp \ util/rbf.cpp \ util/serfloat.cpp \ @@ -988,7 +990,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..37ade5b72e5453 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -23,11 +23,11 @@ #include #include #include -#include #include