From f165a1f4fc8ebd9b7ca060e4a332a687c4d46510 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Sun, 28 May 2017 22:16:48 +0200 Subject: [PATCH] work around a g++ bug in Ubuntu Xenial, closing #5347. --- pdns/pdns_recursor.cc | 6 ++++++ pdns/rec_channel_rec.cc | 6 +++--- pdns/syncres.hh | 2 +- pdns/ws-recursor.cc | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 26908b4cb6..8c8bb94fce 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -103,6 +103,12 @@ static thread_local std::shared_ptr t_traceRegex; static thread_local std::unique_ptr t_tcpClientCounts; thread_local std::unique_ptr MT; // the big MTasker +MT_t* getMT() +{ + return MT ? MT.get() : 0; +} + + thread_local std::unique_ptr t_RC; thread_local std::unique_ptr t_packetCache; thread_local FDMultiplexer* t_fdm{nullptr}; diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index ce3a0d4523..c592b3ca12 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -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() diff --git a/pdns/syncres.hh b/pdns/syncres.hh index e069eafc13..f644fa4c04 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -819,7 +819,7 @@ struct PacketIDBirthdayCompare: public std::binary_function t_RC; extern thread_local std::unique_ptr t_packetCache; typedef MTasker MT_t; -extern thread_local std::unique_ptr MT; +MT_t* getMT(); struct RecursorStats { diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 97734a703a..391cefc370 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -557,7 +557,7 @@ void AsyncServer::asyncWaitForConnections(FDMultiplexer* fdm, const newconnectio void AsyncServer::newConnection() { - MT->makeThread(&AsyncServerNewConnectionMT, this); + getMT()->makeThread(&AsyncServerNewConnectionMT, this); } -- 2.47.2