Merge 057bd3189f into merged_master (Bitcoin PR #19197)

This commit is contained in:
Andrew Poelstra 2020-11-26 01:09:08 +00:00
commit 34f4c80e84

View file

@ -155,6 +155,8 @@ NODISCARD static bool CreatePidFile()
static std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;
static std::thread g_load_block;
static boost::thread_group threadGroup;
void Interrupt(NodeContext& node)
@ -217,9 +219,10 @@ void Shutdown(NodeContext& node)
StopTorControl();
// After everything has been shut down, but before things get flushed, stop the
// CScheduler/checkqueue threadGroup
// CScheduler/checkqueue, threadGroup and load block thread.
if (node.scheduler) node.scheduler->stop();
if (node.reverification_scheduler) node.reverification_scheduler->stop();
if (g_load_block.joinable()) g_load_block.join();
threadGroup.interrupt_all();
threadGroup.join_all();
@ -729,7 +732,6 @@ static void CleanupBlockRevFiles()
static void ThreadImport(ChainstateManager& chainman, std::vector<fs::path> vImportFiles)
{
const CChainParams& chainparams = Params();
util::ThreadRename("loadblk");
ScheduleBatchPriority();
{
@ -1896,7 +1898,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
vImportFiles.push_back(strFile);
}
threadGroup.create_thread([=, &chainman] { ThreadImport(chainman, vImportFiles); });
g_load_block = std::thread(&TraceThread<std::function<void()>>, "loadblk", [=, &chainman]{ ThreadImport(chainman, vImportFiles); });
// Wait for genesis block to be processed
{