本文整理汇总了C++中boost::thread_specific_ptr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ thread_specific_ptr::reset方法的具体用法?C++ thread_specific_ptr::reset怎么用?C++ thread_specific_ptr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::thread_specific_ptr
的用法示例。
在下文中一共展示了thread_specific_ptr::reset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
bool run(const string&, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
nonce64 *n = new nonce64(Security::getNonce());
stringstream ss;
ss << hex << *n;
result.append("nonce", ss.str() );
lastNonce.reset(n);
return true;
}
示例2: setThreadName
Client& Client::initThread(const char *desc, AbstractMessagingPort *mp) {
setThreadName(desc);
assert( currentClient.get() == 0 );
Client *c = new Client(desc, mp);
currentClient.reset(c);
mongo::lastError.initThread();
return *c;
}
示例3:
backtrace_t & backtrace_t::instance() {
static boost::thread_specific_ptr<backtrace_t> instances;
if (instances.get() == NULL) {
instances.reset(new backtrace_t());
}
return *instances;
}
示例4:
boost::asio::io_service&
getGlobalIoService()
{
if (g_ioService.get() == nullptr) {
g_ioService.reset(new boost::asio::io_service());
}
return *g_ioService;
}
示例5:
CLogBuffer& CLogBuffer::GetCLogBuffer()
{
if (_ptr.get() == NULL)
{
_ptr.reset(new CLogBuffer);
}
return *(_ptr.get());
}
示例6: Scheduler
Scheduler&
getGlobalScheduler()
{
if (g_scheduler.get() == nullptr) {
g_scheduler.reset(new Scheduler(getGlobalIoService()));
}
return *g_scheduler;
}
示例7:
boost::asio::io_service* get_io_service(boost::asio::io_service* ioservice= 0 )
{
static boost::thread_specific_ptr<boost::asynchronous::tss_io_service_wrapper> s_io_service;
if (ioservice != 0)
{
s_io_service.reset(new boost::asynchronous::tss_io_service_wrapper(ioservice));
}
return s_io_service.get()->m_io_service;
}
示例8: get_array_data
int* get_array_data()
{
static boost::thread_specific_ptr<boost::array<int, 200> > tp;
if(tp.get() == 0)
tp.reset(new boost::array<int, 200>);
return tp.get()->data();
}
示例9: double
boost::thread_specific_ptr<double>& get_thread_local_aspect_ratio()
{
static boost::thread_specific_ptr<double> aspect_ratio;
if (!aspect_ratio.get())
aspect_ratio.reset(new double(1.0));
return aspect_ratio;
}
示例10: getClient
PlowClient* getClient()
{
static boost::thread_specific_ptr<PlowClient> instance;
if(!instance.get())
{
instance.reset(new PlowClient);
}
return instance.get();
}
示例11:
/*static*/ sources::severity_logger<Logging::Severity>& LogStream::GetLogger()
{
static boost::thread_specific_ptr<sources::severity_logger<Logging::Severity>> s_threadLocalLogger;
if (!s_threadLocalLogger.get())
{
s_threadLocalLogger.reset(new sources::severity_logger<Logging::Severity>());
}
return *(s_threadLocalLogger.get());
}
示例12: ScriptBreakpoint
void Expression::ScriptBreakpoint(ScriptFrame& frame, ScriptError *ex, const DebugInfo& di)
{
bool *inHandler = l_InBreakpointHandler.get();
if (!inHandler || !*inHandler) {
inHandler = new bool(true);
l_InBreakpointHandler.reset(inHandler);
OnBreakpoint(frame, ex, di);
*inHandler = false;
}
}
示例13: operator
void operator()()
{
//int* p = manager::instance().get();
std::string* p = manager::instance().get();
*p = "hello";
//ptr.reset(new (std::nothrow) int(200));
ptr.reset(new (std::nothrow) std::string("world"));
std::cout << "thread 2: " << *ptr << std::endl;
}
示例14: init
void init()
{
static boost::thread_specific_ptr<bool> tls;
if (!tls.get())
{
tls.reset(new bool{true});
boost::lock_guard<boost::mutex> lock{mutex};
std::cout << "done" << '\n';
}
}
示例15: string_generate
UUID UUID::string_generate(const std::string &t_str)
{
static boost::thread_specific_ptr<boost::uuids::string_generator> gen;
if (gen.get() == nullptr) {
gen.reset(new boost::uuids::string_generator);
}
return UUID((*gen)(t_str));
}