aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2024-05-10 22:10:34 +0200
committerTheCharlatan <seb.kung@gmail.com>2024-05-14 10:26:28 +0200
commitd4b17c7d46ad8e2833ade99d5b4c9741c913e84d (patch)
treed15e0cba36fa1fe9cdb2cc615546b31a80434fe4 /src/init.cpp
parent6f1d9064381d834b0f8daa9011f18ba40834d85a (diff)
downloadbitcoin-d4b17c7d46ad8e2833ade99d5b4c9741c913e84d.tar.xz
kernel: Remove batchpriority from kernel library
The current usage of ScheduleBatchPriority is not transparent. Once the thread scheduling is changed, it remains unchanged for the remainder of the thread's lifetime. So move the call from `ImportBlocks` to the init code where it is clearer that its effect lasts for the entire lifetime of the thread. Users of the kernel library might not expect `ImportBlocks` to have an influence on the thread it is called in. Particularly since it is only a compile time option and cannot be controlled at runtime. With this patch users of the kernel library can now choose their own scheduling policy.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index fbf25a0341..d2e0a80780 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -69,6 +69,7 @@
#include <txdb.h>
#include <txmempool.h>
#include <util/asmap.h>
+#include <util/batchpriority.h>
#include <util/chaintype.h>
#include <util/check.h>
#include <util/fs.h>
@@ -1735,6 +1736,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
chainman.m_thread_load = std::thread(&util::TraceThread, "initload", [=, &chainman, &args, &node] {
+ ScheduleBatchPriority();
// Import blocks
ImportBlocks(chainman, vImportFiles);
if (args.GetBoolArg("-stopafterblockimport", DEFAULT_STOPAFTERBLOCKIMPORT)) {