Skip to content

Instantly share code, notes, and snippets.

@jamesob
Created July 12, 2018 14:29
Show Gist options
  • Save jamesob/eb392fa435782d3b34cf04de90959ffa to your computer and use it in GitHub Desktop.
Save jamesob/eb392fa435782d3b34cf04de90959ffa to your computer and use it in GitHub Desktop.
diff -uw <(git diff master..threadnames2.15) <(git diff master..threadnames2.16)
--- /proc/self/fd/12 2018-07-12 10:27:34.977243847 -0400
+++ /proc/self/fd/13 2018-07-12 10:27:34.981243902 -0400
@@ -94,7 +94,7 @@
// Parameters
//
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
-index bd08b04..1355071 100644
+index bd08b04..229ff86 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -6,6 +6,7 @@
@@ -131,7 +131,7 @@
+static void HTTPWorkQueueRun(WorkQueue<HTTPClosure>* queue, int worker_num)
{
- RenameThread("bitcoin-httpworker");
-+ thread_util::Rename(("httpworker." + std::to_string(worker_num)).c_str());
++ thread_util::Rename(strprintf("httpworker.%i", worker_num));
queue->Run();
}
@@ -200,14 +200,13 @@
// Start the lightweight task scheduler thread
diff --git a/src/logging.cpp b/src/logging.cpp
-index e8e22cb..76b56e0 100644
+index e8e22cb..75e600d 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
-@@ -5,6 +5,12 @@
+@@ -5,6 +5,11 @@
#include <logging.h>
#include <utiltime.h>
-+#include <util.h>
+#include <utilstrencodings.h>
+#include <threadutil.h>
+
@@ -216,7 +215,7 @@
const char * const DEFAULT_DEBUGLOGFILE = "debug.log";
-@@ -168,7 +174,7 @@ std::vector<CLogCategoryActive> ListActiveLogCategories()
+@@ -168,7 +173,7 @@ std::vector<CLogCategoryActive> ListActiveLogCategories()
return ret;
}
@@ -225,7 +224,7 @@
{
std::string strStamped;
-@@ -178,6 +184,7 @@ std::string BCLog::Logger::LogTimestampStr(const std::string &str)
+@@ -178,6 +183,7 @@ std::string BCLog::Logger::LogTimestampStr(const std::string &str)
if (m_started_new_line) {
int64_t nTimeMicros = GetTimeMicros();
strStamped = FormatISO8601DateTime(nTimeMicros/1000000);
@@ -233,7 +232,7 @@
if (m_log_time_micros) {
strStamped.pop_back();
strStamped += strprintf(".%06dZ", nTimeMicros%1000000);
-@@ -190,21 +197,27 @@ std::string BCLog::Logger::LogTimestampStr(const std::string &str)
+@@ -190,21 +196,27 @@ std::string BCLog::Logger::LogTimestampStr(const std::string &str)
} else
strStamped = str;
@@ -268,7 +267,7 @@
fflush(stdout);
}
if (m_print_to_file) {
-@@ -212,7 +225,7 @@ void BCLog::Logger::LogPrintStr(const std::string &str)
+@@ -212,7 +224,7 @@ void BCLog::Logger::LogPrintStr(const std::string &str)
// buffer if we haven't opened the log yet
if (m_fileout == nullptr) {
@@ -277,7 +276,7 @@
}
else
{
-@@ -226,7 +239,7 @@ void BCLog::Logger::LogPrintStr(const std::string &str)
+@@ -226,7 +238,7 @@ void BCLog::Logger::LogPrintStr(const std::string &str)
setbuf(m_fileout, nullptr); // unbuffered
}
@@ -674,7 +673,7 @@
{
LogPrintf("%s thread start\n", name);
diff --git a/src/validation.cpp b/src/validation.cpp
-index 9921063..fbe8433 100644
+index 9921063..226455a 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -43,6 +43,7 @@
@@ -692,7 +691,7 @@
-void ThreadScriptCheck() {
- RenameThread("bitcoin-scriptch");
+void ThreadScriptCheck(int worker_num) {
-+ thread_util::Rename(("scriptch." + std::to_string(worker_num)).c_str());
++ thread_util::Rename(strprintf("scriptch.%i", worker_num));
scriptcheckqueue.Thread();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment