本文整理汇总了C++中thread_specific_ptr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ thread_specific_ptr::reset方法的具体用法?C++ thread_specific_ptr::reset怎么用?C++ thread_specific_ptr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thread_specific_ptr
的用法示例。
在下文中一共展示了thread_specific_ptr::reset方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: worker
inline void worker(
std::uint64_t updates
)
{
global_scratch.reset(new double);
for (double i = 0.; i < updates; ++i)
*global_scratch += 1. / (2. * i + 1.);
global_scratch.reset();
}
示例2: checkTSSInit
void checkTSSInit()
{
if(m_transactionInProgress.get() == 0)
{
m_transactionInProgress.reset(new bool);
(*m_transactionInProgress) = false;
}
if(m_transaction.get() == 0)
{
m_transaction.reset(new DbTxn *);
(*m_transaction) = NULL;
}
}
示例3: CurrentContextOrNull
std::shared_ptr<CoreContext> CoreContext::SetCurrent(const std::shared_ptr<CoreContext>& ctxt) {
const auto& currentContext = CurrentContextOrNull();
// Short-circuit test, no need to proceed if we aren't changing the context:
if (currentContext == ctxt)
return currentContext;
// Value is changing, update:
auto retVal = currentContext;
if (ctxt)
autoCurrentContext.reset(new std::shared_ptr<CoreContext>(ctxt));
else
autoCurrentContext.reset();
return retVal;
}
示例4: run
virtual bool run(OperationContext* txn,
const string&,
BSONObj& cmdObj,
int,
string& errmsg,
BSONObjBuilder& result) {
string fromhost = cmdObj.getStringField("fromhost");
if ( fromhost.empty() ) {
/* copy from self */
stringstream ss;
ss << "localhost:" << serverGlobalParams.port;
fromhost = ss.str();
}
const ConnectionString cs(uassertStatusOK(ConnectionString::parse(fromhost)));
authConn_.reset(cs.connect(errmsg));
if (!authConn_.get()) {
return false;
}
BSONObj ret;
if( !authConn_->runCommand( "admin", BSON( "getnonce" << 1 ), ret ) ) {
errmsg = "couldn't get nonce " + ret.toString();
return false;
}
result.appendElements( ret );
return true;
}
示例5: threadInstance
static ClientConnections* threadInstance() {
ClientConnections* cc = _perThread.get();
if ( ! cc ) {
cc = new ClientConnections();
_perThread.reset( cc );
}
return cc;
}
示例6: bool
disable_syscall_interruption() {
if (_syscalls_interruptable.get() == NULL) {
last_value = true;
_syscalls_interruptable.reset(new bool(false));
} else {
last_value = *_syscalls_interruptable;
*_syscalls_interruptable = false;
}
}
示例7: operator
ostream & operator()() {
ThreadOutputStream * tos( threadOutputStream_.get() );
if( tos == nullptr ) {
tos = new ThreadOutputStream();
threadOutputStream_.reset( tos );
}
return (*tos) << boost::posix_time::microsec_clock::universal_time() <<
' ' << format("%014s") % boost::this_thread::get_id() <<
" [ " << format("%-20.20s") % name_ << " ] ";
};
示例8: ScopeCache
/** Get a scope from the pool of scopes matching the supplied pool name */
auto_ptr<Scope> ScriptEngine::getPooledScope(const string& pool) {
if (!scopeCache.get())
scopeCache.reset(new ScopeCache());
Scope* s = scopeCache->get(pool);
if (!s)
s = newScope();
auto_ptr<Scope> p;
p.reset(new PooledScope(pool, s));
return p;
}
示例9: ScopeCache
/** Get a scope from the pool of scopes matching the supplied pool name */
auto_ptr<Scope> ScriptEngine::getPooledScope(const string& pool, const string& scopeType) {
if (!scopeCache.get())
scopeCache.reset(new ScopeCache());
Scope* s = scopeCache->get(pool + scopeType);
if (!s)
s = newScope();
auto_ptr<Scope> p;
p.reset(new PooledScope(pool + scopeType, s));
p->setLocalDB(pool);
p->loadStored(true);
return p;
}
示例10:
Glob::Glob(const std::string& pattern, GlobFlags flags)
{
globObject.reset(this);
posix::glob_t glob;
posix::glob(pattern.c_str(), flags, &onGlobError, &glob);
globObject.release();
if (glob.gl_pathc) {
for (char** p = glob.gl_pathv; *p != NULL; ++p) {
pathNames_.push_back(*p);
}
}
posix::globfree(&glob);
}
示例11: run
virtual bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
string fromhost = cmdObj.getStringField("fromhost");
if ( fromhost.empty() ) {
/* copy from self */
stringstream ss;
ss << "localhost:" << cmdLine.port;
fromhost = ss.str();
}
authConn_.reset( new DBClientConnection() );
BSONObj ret;
{
dbtemprelease t;
if ( !authConn_->connect( fromhost, errmsg ) )
return false;
if( !authConn_->runCommand( "admin", BSON( "getnonce" << 1 ), ret ) ) {
errmsg = "couldn't get nonce " + string( ret );
return false;
}
}
result.appendElements( ret );
return true;
}
示例12: unlock
void unlock ()
{
this_thread_hierarchy_value.reset(new unsigned long(previous_hierarchy_value));
internal_mutex.unlock ();
}
示例13: update_hierarchy_value
void update_hierarchy_value ()
{
previous_hierarchy_value = *this_thread_hierarchy_value;
this_thread_hierarchy_value.reset(new unsigned long(hierarchy_value));
}
示例14: EvictCurrent
void CoreContext::EvictCurrent(void) {
autoCurrentContext.reset();
}