From d69c46292dc266cbedcea1578401fc9a896edc43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Wed, 20 May 2026 14:56:08 +0300 Subject: [PATCH] util: zero-pad thread number suffixes Thread names with numeric suffixes are easier to scan when the suffixes use a fixed width. Format `ThreadPool` and script-check worker suffixes as two digits while keeping the compact dotted convention. Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com> --- doc/developer-notes.md | 4 ++-- src/checkqueue.h | 2 +- src/util/threadpool.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index c7ec0ca4381..129fdda7988 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -699,13 +699,13 @@ and its `cs_KeyStore` lock for example). : Performs various loading tasks that are part of init but shouldn't block the node from being started: external block import, reindex, reindex-chainstate, main chain activation, spawn indexes background sync threads and mempool load. -- [CCheckQueue::Loop (`b-scriptch.x`)](https://doxygen.bitcoincore.org/class_c_check_queue.html#checkqueue) +- [CCheckQueue::Loop (`b-scriptch.xx`)](https://doxygen.bitcoincore.org/class_c_check_queue.html#checkqueue) : Parallel script validation threads for transactions in blocks. - [ThreadHTTP (`b-http`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#http) : Libevent thread to listen for RPC and REST connections. -- [HTTP worker threads (`b-http.x`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#http_pool) +- [HTTP worker threads (`b-http.xx`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#http_pool) : Threads to service RPC and REST requests. - [Indexer threads (`b-txindex`, etc)](https://doxygen.bitcoincore.org/class_base_index.html#index_sync) diff --git a/src/checkqueue.h b/src/checkqueue.h index 1e265525df8..7d107a186f1 100644 --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -149,7 +149,7 @@ public: m_worker_threads.reserve(worker_threads_num); for (int n = 0; n < worker_threads_num; ++n) { m_worker_threads.emplace_back([this, n]() { - util::ThreadRename(strprintf("scriptch.%i", n)); + util::ThreadRename(strprintf("scriptch.%02i", n)); Loop(false /* worker thread */); }); } diff --git a/src/util/threadpool.h b/src/util/threadpool.h index 6e35df2787f..6c168515257 100644 --- a/src/util/threadpool.h +++ b/src/util/threadpool.h @@ -112,7 +112,7 @@ public: // Create workers m_workers.reserve(num_workers); for (int i = 0; i < num_workers; i++) { - m_workers.emplace_back(&util::TraceThread, strprintf("%s.%d", m_name, i), [this] { WorkerThread(); }); + m_workers.emplace_back(&util::TraceThread, strprintf("%s.%02d", m_name, i), [this] { WorkerThread(); }); } }