mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
kernel: Move background load thread to node context
The thread handle is never used by the ChainstateManager, so move it out and into the node context. Users of the kernel library now no longer have to manually join the thread when destructing the ChainstateManager.
This commit is contained in:
parent
a5e99669cc
commit
bc7900f33d
4 changed files with 4 additions and 6 deletions
|
|
@ -298,7 +298,7 @@ void Shutdown(NodeContext& node)
|
|||
|
||||
StopTorControl();
|
||||
|
||||
if (node.chainman && node.chainman->m_thread_load.joinable()) node.chainman->m_thread_load.join();
|
||||
if (node.background_init_thread.joinable()) node.background_init_thread.join();
|
||||
// After everything has been shut down, but before things get flushed, stop the
|
||||
// the scheduler. After this point, SyncWithValidationInterfaceQueue() should not be called anymore
|
||||
// as this would prevent the shutdown from completing.
|
||||
|
|
@ -1789,7 +1789,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
vImportFiles.push_back(fs::PathFromString(strFile));
|
||||
}
|
||||
|
||||
chainman.m_thread_load = std::thread(&util::TraceThread, "initload", [=, &chainman, &args, &node] {
|
||||
node.background_init_thread = std::thread(&util::TraceThread, "initload", [=, &chainman, &args, &node] {
|
||||
ScheduleBatchPriority();
|
||||
// Import blocks
|
||||
ImportBlocks(chainman, vImportFiles);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue