mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
init: change shutdown order of load block thread and scheduler
This avoids situations during a reindex in which shutdown doesn't finish since SyncWithValidationInterfaceQueue is called by the load block thread when the scheduler is already stopped.
This commit is contained in:
parent
33af14e31b
commit
5fd4836019
1 changed files with 4 additions and 3 deletions
|
@ -296,10 +296,11 @@ void Shutdown(NodeContext& node)
|
|||
|
||||
StopTorControl();
|
||||
|
||||
// After everything has been shut down, but before things get flushed, stop the
|
||||
// scheduler and load block thread.
|
||||
if (node.scheduler) node.scheduler->stop();
|
||||
if (node.chainman && node.chainman->m_thread_load.joinable()) node.chainman->m_thread_load.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.
|
||||
if (node.scheduler) node.scheduler->stop();
|
||||
|
||||
// After the threads that potentially access these pointers have been stopped,
|
||||
// destruct and reset all to nullptr.
|
||||
|
|
Loading…
Add table
Reference in a new issue