mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-18 11:30:44 +01:00
Move global scriptcheckqueue into ChainstateManager class
This commit is contained in:
20
src/init.cpp
20
src/init.cpp
@@ -271,7 +271,7 @@ void Shutdown(NodeContext& node)
|
||||
// CScheduler/checkqueue, 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();
|
||||
StopScriptCheckWorkerThreads();
|
||||
if (node.chainman) node.chainman->StopScriptCheckWorkerThreads();
|
||||
|
||||
// After the threads that potentially access these pointers have been stopped,
|
||||
// destruct and reset all to nullptr.
|
||||
@@ -1109,24 +1109,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
return InitError(strprintf(_("Unable to allocate memory for -maxsigcachesize: '%s' MiB"), args.GetIntArg("-maxsigcachesize", DEFAULT_MAX_SIG_CACHE_BYTES >> 20)));
|
||||
}
|
||||
|
||||
int script_threads = args.GetIntArg("-par", DEFAULT_SCRIPTCHECK_THREADS);
|
||||
if (script_threads <= 0) {
|
||||
// -par=0 means autodetect (number of cores - 1 script threads)
|
||||
// -par=-n means "leave n cores free" (number of cores - n - 1 script threads)
|
||||
script_threads += GetNumCores();
|
||||
}
|
||||
|
||||
// Subtract 1 because the main thread counts towards the par threads
|
||||
script_threads = std::max(script_threads - 1, 0);
|
||||
|
||||
// Number of script-checking threads <= MAX_SCRIPTCHECK_THREADS
|
||||
script_threads = std::min(script_threads, MAX_SCRIPTCHECK_THREADS);
|
||||
|
||||
LogPrintf("Script verification uses %d additional threads\n", script_threads);
|
||||
if (script_threads >= 1) {
|
||||
StartScriptCheckWorkerThreads(script_threads);
|
||||
}
|
||||
|
||||
assert(!node.scheduler);
|
||||
node.scheduler = std::make_unique<CScheduler>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user