|
41 | 41 | #include <script/sigcache.h>
|
42 | 42 | #include <scheduler.h>
|
43 | 43 | #include <shutdown.h>
|
| 44 | +#include <util/threadnames.h> |
44 | 45 | #include <timedata.h>
|
45 | 46 | #include <txdb.h>
|
46 | 47 | #include <txmempool.h>
|
@@ -206,7 +207,7 @@ void Shutdown(InitInterfaces& interfaces)
|
206 | 207 | /// for example if the data directory was found to be locked.
|
207 | 208 | /// Be sure that anything that writes files or flushes caches only does this if the respective
|
208 | 209 | /// module was initialized.
|
209 |
| - RenameThread("bitcoin-shutoff"); |
| 210 | + util::ThreadRename("shutoff"); |
210 | 211 | mempool.AddTransactionsUpdated(1);
|
211 | 212 |
|
212 | 213 | StopHTTPRPC();
|
@@ -506,6 +507,7 @@ void SetupServerArgs()
|
506 | 507 | gArgs.AddArg("-debugexclude=<category>", strprintf("Exclude debugging information for a category. Can be used in conjunction with -debug=1 to output debug logs for all categories except one or more specified categories."), false, OptionsCategory::DEBUG_TEST);
|
507 | 508 | gArgs.AddArg("-logips", strprintf("Include IP addresses in debug output (default: %u)", DEFAULT_LOGIPS), false, OptionsCategory::DEBUG_TEST);
|
508 | 509 | gArgs.AddArg("-logtimestamps", strprintf("Prepend debug output with timestamp (default: %u)", DEFAULT_LOGTIMESTAMPS), false, OptionsCategory::DEBUG_TEST);
|
| 510 | + gArgs.AddArg("-logthreadnames", strprintf("Prepend debug output with name of the originating thread (only available on platforms supporting thread_local) (default: %u)", DEFAULT_LOGTHREADNAMES), false, OptionsCategory::DEBUG_TEST); |
509 | 511 | gArgs.AddArg("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS), true, OptionsCategory::DEBUG_TEST);
|
510 | 512 | gArgs.AddArg("-mocktime=<n>", "Replace actual time with <n> seconds since epoch (default: 0)", true, OptionsCategory::DEBUG_TEST);
|
511 | 513 | gArgs.AddArg("-maxsigcachesize=<n>", strprintf("Limit sum of signature cache and script execution cache sizes to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE), true, OptionsCategory::DEBUG_TEST);
|
@@ -666,7 +668,7 @@ static void CleanupBlockRevFiles()
|
666 | 668 | static void ThreadImport(std::vector<fs::path> vImportFiles)
|
667 | 669 | {
|
668 | 670 | const CChainParams& chainparams = Params();
|
669 |
| - RenameThread("bitcoin-loadblk"); |
| 671 | + util::ThreadRename("loadblk"); |
670 | 672 | ScheduleBatchPriority();
|
671 | 673 |
|
672 | 674 | {
|
@@ -862,6 +864,7 @@ void InitLogging()
|
862 | 864 | LogInstance().m_print_to_console = gArgs.GetBoolArg("-printtoconsole", !gArgs.GetBoolArg("-daemon", false));
|
863 | 865 | LogInstance().m_log_timestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS);
|
864 | 866 | LogInstance().m_log_time_micros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);
|
| 867 | + LogInstance().m_log_threadnames = gArgs.GetBoolArg("-logthreadnames", DEFAULT_LOGTHREADNAMES); |
865 | 868 |
|
866 | 869 | fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS);
|
867 | 870 |
|
@@ -1286,7 +1289,7 @@ bool AppInitMain(InitInterfaces& interfaces)
|
1286 | 1289 | LogPrintf("Using %u threads for script verification\n", nScriptCheckThreads);
|
1287 | 1290 | if (nScriptCheckThreads) {
|
1288 | 1291 | for (int i=0; i<nScriptCheckThreads-1; i++)
|
1289 |
| - threadGroup.create_thread(&ThreadScriptCheck); |
| 1292 | + threadGroup.create_thread([i]() { return ThreadScriptCheck(i); }); |
1290 | 1293 | }
|
1291 | 1294 |
|
1292 | 1295 | // Start the lightweight task scheduler thread
|
|
0 commit comments