@@ -152,6 +152,8 @@ NODISCARD static bool CreatePidFile()
152
152
153
153
static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;
154
154
155
+ static std::thread g_load_block;
156
+
155
157
static boost::thread_group threadGroup;
156
158
157
159
void Interrupt (NodeContext& node)
@@ -214,8 +216,9 @@ void Shutdown(NodeContext& node)
214
216
StopTorControl ();
215
217
216
218
// After everything has been shut down, but before things get flushed, stop the
217
- // CScheduler/checkqueue threadGroup
219
+ // CScheduler/checkqueue, threadGroup and load block thread.
218
220
if (node.scheduler ) node.scheduler ->stop ();
221
+ if (g_load_block.joinable ()) g_load_block.join ();
219
222
threadGroup.interrupt_all ();
220
223
threadGroup.join_all ();
221
224
@@ -680,7 +683,6 @@ static void CleanupBlockRevFiles()
680
683
static void ThreadImport (ChainstateManager& chainman, std::vector<fs::path> vImportFiles)
681
684
{
682
685
const CChainParams& chainparams = Params ();
683
- util::ThreadRename (" loadblk" );
684
686
ScheduleBatchPriority ();
685
687
686
688
{
@@ -1842,7 +1844,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
1842
1844
vImportFiles.push_back (strFile);
1843
1845
}
1844
1846
1845
- threadGroup. create_thread ( [=, &chainman] { ThreadImport (chainman, vImportFiles); });
1847
+ g_load_block = std::thread (&TraceThread<std::function< void ()>>, " loadblk " , [=, &chainman]{ ThreadImport (chainman, vImportFiles); });
1846
1848
1847
1849
// Wait for genesis block to be processed
1848
1850
{
0 commit comments