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};
{
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)
uint64_t* pleaseGetConcurrentQueries()
{
- return new uint64_t(MT ? MT->numProcesses() : 0);
+ return new uint64_t(getMT() ? getMT()->numProcesses() : 0);
}
static uint64_t getConcurrentQueries()
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
{
void AsyncServer::newConnection()
{
- MT->makeThread(&AsyncServerNewConnectionMT, this);
+ getMT()->makeThread(&AsyncServerNewConnectionMT, this);
}