]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
ixfrdist: name threads
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 27 Sep 2018 11:20:03 +0000 (13:20 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 27 Sep 2018 11:20:03 +0000 (13:20 +0200)
pdns/ixfrdist.cc

index ec46456a08d7e45a0aecf9bb3ef71f8b3caf64cf..cee9377b5babb33a04ea348534710ab23564e90a 100644 (file)
@@ -30,6 +30,7 @@
 #include <sys/stat.h>
 #include <mutex>
 #include <thread>
+#include <pthread.h>
 #include <dirent.h>
 #include <queue>
 #include <condition_variable>
@@ -234,6 +235,11 @@ static void updateCurrentZoneInfo(const DNSName& domain, std::shared_ptr<ixfrinf
 }
 
 void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& axfrTimeout) {
+  string threadName = "ixfrdist/update";
+  auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+  if (retval != 0) {
+    g_log<<Logger::Warning<<"Could not set thread name "<<threadName<<" for update thread: "<<strerror(retval)<<endl;
+  }
   std::map<DNSName, time_t> lastCheck;
 
   // Initialize the serials we have
@@ -768,6 +774,11 @@ static void handleTCPRequest(int fd, boost::any&) {
 /* Thread to handle TCP traffic
  */
 static void tcpWorker(int tid) {
+  string threadName = "ixfrdist/tcpWor";
+  auto retval = pthread_setname_np(pthread_self(), const_cast<char*>(threadName.c_str()));
+  if (retval != 0) {
+    g_log<<Logger::Warning<<"Could not set thread name "<<threadName<<" for update thread: "<<strerror(retval)<<endl;
+  }
   string prefix = "TCP Worker " + std::to_string(tid) + ": ";
 
   while(true) {