Skip to content

Commit

Permalink
init: Setup scheduler in tests and init in exactly the same way
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed May 21, 2020
1 parent 25ad2c6 commit fa4ea99
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1317,8 +1317,7 @@ bool AppInitMain(const util::Ref& context, NodeContext& node)
node.scheduler = MakeUnique<CScheduler>();

// Start the lightweight task scheduler thread
CScheduler::Function serviceLoop = [&node]{ node.scheduler->serviceQueue(); };
threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));
threadGroup.create_thread([&] { TraceThread("scheduler", [&] { node.scheduler->serviceQueue(); }); });

// Gather some entropy once per minute.
node.scheduler->scheduleEvery([]{
Expand Down
2 changes: 1 addition & 1 deletion src/test/util/setup_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const

// We have to run a scheduler thread to prevent ActivateBestChain
// from blocking due to queue overrun.
threadGroup.create_thread([&]{ m_node.scheduler->serviceQueue(); });
threadGroup.create_thread([&] { TraceThread("scheduler", [&] { m_node.scheduler->serviceQueue(); }); });
GetMainSignals().RegisterBackgroundSignalScheduler(*m_node.scheduler);

pblocktree.reset(new CBlockTreeDB(1 << 20, true));
Expand Down

0 comments on commit fa4ea99

Please sign in to comment.