Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
#include <rpc/register.h> | #include <rpc/register.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <rpc/util.h> | #include <rpc/util.h> | ||||
#include <scheduler.h> | #include <scheduler.h> | ||||
#include <script/scriptcache.h> | #include <script/scriptcache.h> | ||||
#include <script/sigcache.h> | #include <script/sigcache.h> | ||||
#include <script/standard.h> | #include <script/standard.h> | ||||
#include <shutdown.h> | #include <shutdown.h> | ||||
#include <sync.h> | |||||
#include <timedata.h> | #include <timedata.h> | ||||
#include <torcontrol.h> | #include <torcontrol.h> | ||||
#include <txdb.h> | #include <txdb.h> | ||||
#include <txmempool.h> | #include <txmempool.h> | ||||
#include <util/asmap.h> | #include <util/asmap.h> | ||||
#include <util/check.h> | #include <util/check.h> | ||||
#include <util/moneystr.h> | #include <util/moneystr.h> | ||||
#include <util/threadnames.h> | #include <util/threadnames.h> | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | void Interrupt(NodeContext &node) { | ||||
} | } | ||||
if (g_txindex) { | if (g_txindex) { | ||||
g_txindex->Interrupt(); | g_txindex->Interrupt(); | ||||
} | } | ||||
ForEachBlockFilterIndex([](BlockFilterIndex &index) { index.Interrupt(); }); | ForEachBlockFilterIndex([](BlockFilterIndex &index) { index.Interrupt(); }); | ||||
} | } | ||||
void Shutdown(NodeContext &node) { | void Shutdown(NodeContext &node) { | ||||
LogPrintf("%s: In progress...\n", __func__); | static Mutex g_shutdown_mutex; | ||||
static RecursiveMutex cs_Shutdown; | TRY_LOCK(g_shutdown_mutex, lock_shutdown); | ||||
TRY_LOCK(cs_Shutdown, lockShutdown); | if (!lock_shutdown) { | ||||
if (!lockShutdown) { | |||||
return; | return; | ||||
} | } | ||||
LogPrintf("%s: In progress...\n", __func__); | |||||
Assert(node.args); | Assert(node.args); | ||||
/// Note: Shutdown() must be able to handle cases in which initialization | /// Note: Shutdown() must be able to handle cases in which initialization | ||||
/// failed part of the way, for example if the data directory was found to | /// failed part of the way, for example if the data directory was found to | ||||
/// be locked. Be sure that anything that writes files or flushes caches | /// be locked. Be sure that anything that writes files or flushes caches | ||||
/// only does this if the respective module was initialized. | /// only does this if the respective module was initialized. | ||||
util::ThreadRename("shutoff"); | util::ThreadRename("shutoff"); | ||||
g_mempool.AddTransactionsUpdated(1); | g_mempool.AddTransactionsUpdated(1); | ||||
▲ Show 20 Lines • Show All 2,768 Lines • Show Last 20 Lines |