]> granicus.if.org Git - pdns/commitdiff
work around a g++ bug in Ubuntu Xenial, closing #5347.
authorbert hubert <bert.hubert@netherlabs.nl>
Sun, 28 May 2017 20:16:48 +0000 (22:16 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Sun, 28 May 2017 20:16:48 +0000 (22:16 +0200)
pdns/pdns_recursor.cc
pdns/rec_channel_rec.cc
pdns/syncres.hh
pdns/ws-recursor.cc

index 26908b4cb670693a176849edcf1f2bfe7735d17d..8c8bb94fce9baed1809622e45fc22fa13c6cbc09 100644 (file)
@@ -103,6 +103,12 @@ static thread_local std::shared_ptr<Regex> t_traceRegex;
 static thread_local std::unique_ptr<tcpClientCounts_t> t_tcpClientCounts;
 
 thread_local std::unique_ptr<MT_t> MT; // the big MTasker
+MT_t* getMT()
+{
+  return MT ? MT.get() : 0;
+}
+
+
 thread_local std::unique_ptr<MemRecursorCache> t_RC;
 thread_local std::unique_ptr<RecursorPacketCache> t_packetCache;
 thread_local FDMultiplexer* t_fdm{nullptr};
index ce3a0d452358c3a6d6edfe44305bd9ddd93c76f3..c592b3ca1227f6041e0a21507317991e416bcf87 100644 (file)
@@ -596,13 +596,13 @@ static string* pleaseGetCurrentQueries()
 {
   ostringstream ostr;
 
-  ostr << MT->d_waiters.size() <<" currently outstanding questions\n";
+  ostr << getMT()->d_waiters.size() <<" currently outstanding questions\n";
 
   boost::format fmt("%1% %|40t|%2% %|47t|%3% %|63t|%4% %|68t|%5%\n");
 
   ostr << (fmt % "qname" % "qtype" % "remote" % "tcp" % "chained");
   int n=0;
-  for(MT_t::waiters_t::iterator mthread=MT->d_waiters.begin(); mthread!=MT->d_waiters.end() && n < 100; ++mthread, ++n) {
+  for(MT_t::waiters_t::iterator mthread=getMT()->d_waiters.begin(); mthread!=getMT()->d_waiters.end() && n < 100; ++mthread, ++n) {
     const PacketID& pident = mthread->key;
     ostr << (fmt 
              % pident.domain.toLogString() /* ?? */ % DNSRecordContent::NumberToType(pident.type) 
@@ -662,7 +662,7 @@ uint64_t getNsSpeedsSize()
 
 uint64_t* pleaseGetConcurrentQueries()
 {
-  return new uint64_t(MT ? MT->numProcesses() : 0);
+  return new uint64_t(getMT() ? getMT()->numProcesses() : 0);
 }
 
 static uint64_t getConcurrentQueries()
index e069eafc13e032785a22d92407c849dd49cded89..f644fa4c04a8a2eea152b1a7702b66a221262b1a 100644 (file)
@@ -819,7 +819,7 @@ struct PacketIDBirthdayCompare: public std::binary_function<PacketID, PacketID,
 extern thread_local std::unique_ptr<MemRecursorCache> t_RC;
 extern thread_local std::unique_ptr<RecursorPacketCache> t_packetCache;
 typedef MTasker<PacketID,string> MT_t;
-extern thread_local std::unique_ptr<MT_t> MT;
+MT_t* getMT();
 
 struct RecursorStats
 {
index 97734a703abb662e664930ecedfc9d52a8dd6a3b..391cefc3708c9ecbf979385e5940b0f04eb77e5e 100644 (file)
@@ -557,7 +557,7 @@ void AsyncServer::asyncWaitForConnections(FDMultiplexer* fdm, const newconnectio
 
 void AsyncServer::newConnection()
 {
-  MT->makeThread(&AsyncServerNewConnectionMT, this);
+  getMT()->makeThread(&AsyncServerNewConnectionMT, this);
 }