X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Finit.cpp;h=9c65dabb6b5c5fcb6587468be6a741aeac8fa6c0;hp=37c43a50c3a2416e7f50d4fb85fbb6f475c780b4;hb=273ceadcc0475b03a2be03ffbeded0831d8232fc;hpb=6a4bd809d3d79209ef43ee55304e744d23409582 diff --git a/src/init.cpp b/src/init.cpp index 37c43a5..9c65dab 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -68,7 +68,7 @@ void Shutdown(void* parg) static bool fTaken; // Make this thread recognisable as the shutdown thread - RenameThread("bitcoin-shutoff"); + RenameThread("novacoin-shutoff"); bool fFirstThread = false; { @@ -86,6 +86,10 @@ void Shutdown(void* parg) nTransactionsUpdated++; // CTxDB().Close(); bitdb.Flush(false); + { + LOCK(cs_main); + ThreadScriptCheckQuit(); + } StopNode(); bitdb.Flush(true); boost::filesystem::remove(GetPidFile()); @@ -298,6 +302,7 @@ std::string HelpMessage() " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + "\n" + " -checkblocks= " + _("How many blocks to check at startup (default: 2500, 0 = all)") + "\n" + " -checklevel= " + _("How thorough the block verification is (0-6, default: 1)") + "\n" + + " -par=N " + _("Set the number of script verification threads (1-16, 0=auto, default: 0)") + "\n" + " -loadblock= " + _("Imports blocks from external blk000?.dat file") + "\n" + "\n" + _("Block creation options:") + "\n" + @@ -421,6 +426,15 @@ bool AppInit2() // ********************************************************* Step 3: parameter-to-internal-flags + // -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency + nScriptCheckThreads = GetArg("-par", 0); + if (nScriptCheckThreads == 0) + nScriptCheckThreads = boost::thread::hardware_concurrency(); + if (nScriptCheckThreads <= 1) + nScriptCheckThreads = 0; + else if (nScriptCheckThreads > MAX_SCRIPTCHECK_THREADS) + nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS; + fDebug = GetBoolArg("-debug"); // -debug implies fDebug* @@ -533,6 +547,12 @@ bool AppInit2() if (fDaemon) fprintf(stdout, "NovaCoin server starting\n"); + if (nScriptCheckThreads) { + printf("Using %u threads for script verification\n", nScriptCheckThreads); + for (int i=0; i