#include "threadcontext.h" // std #include using namespace osdev::components::mqtt; ThreadContextScope::ThreadContextScope( const std::string &_context ) : m_previousContext( ThreadContext::instance().context() ) { ThreadContext::instance().setContext( _context ); } ThreadContextScope::~ThreadContextScope() { ThreadContext::instance().setContext( m_previousContext ); } // static ThreadContext& ThreadContext::instance() { static thread_local ThreadContext tc; return tc; } ThreadContext::ThreadContext() : m_context( "default" ) { }