mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-24 07:51:24 +02:00
shutdown: Stop threads before resetting ptrs
This commit is contained in:
parent
1ef57a96b8
commit
faab63111d
12
src/init.cpp
12
src/init.cpp
@ -209,11 +209,7 @@ void Shutdown()
|
|||||||
// using the other before destroying them.
|
// using the other before destroying them.
|
||||||
if (peerLogic) UnregisterValidationInterface(peerLogic.get());
|
if (peerLogic) UnregisterValidationInterface(peerLogic.get());
|
||||||
if (g_connman) g_connman->Stop();
|
if (g_connman) g_connman->Stop();
|
||||||
peerLogic.reset();
|
if (g_txindex) g_txindex->Stop();
|
||||||
g_connman.reset();
|
|
||||||
if (g_txindex) {
|
|
||||||
g_txindex.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
StopTorControl();
|
StopTorControl();
|
||||||
|
|
||||||
@ -222,6 +218,12 @@ void Shutdown()
|
|||||||
threadGroup.interrupt_all();
|
threadGroup.interrupt_all();
|
||||||
threadGroup.join_all();
|
threadGroup.join_all();
|
||||||
|
|
||||||
|
// After the threads that potentially access these pointers have been stopped,
|
||||||
|
// destruct and reset all to nullptr.
|
||||||
|
peerLogic.reset();
|
||||||
|
g_connman.reset();
|
||||||
|
g_txindex.reset();
|
||||||
|
|
||||||
if (g_is_mempool_loaded && gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
|
if (g_is_mempool_loaded && gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
|
||||||
DumpMempool();
|
DumpMempool();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user