本文整理汇总了C++中xbmcthreads::ThreadLocal::set方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadLocal::set方法的具体用法?C++ ThreadLocal::set怎么用?C++ ThreadLocal::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmcthreads::ThreadLocal
的用法示例。
在下文中一共展示了ThreadLocal::set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TraceGuard::TraceGuard() :function(NULL)
{
parent = tlParent.get();
depth = parent == NULL ? 0 : parent->depth + 1;
tlParent.set(this);
// silent
}
示例2: clearLanguageHook
void LanguageHook::clearLanguageHook()
{
LanguageHook* lh = addonLanguageHookTls.get();
addonLanguageHookTls.set(NULL);
if (lh)
lh->Release();
}
示例3: staticThread
THREADFUNC CThread::staticThread(void* data)
{
CThread* pThread = (CThread*)(data);
std::string name;
ThreadIdentifier id;
bool autodelete;
if (!pThread) {
CLog::Log(LOGERROR,"%s, sanity failed. thread is NULL.",__FUNCTION__);
return 1;
}
name = pThread->m_ThreadName;
id = pThread->m_ThreadId;
autodelete = pThread->m_bAutoDelete;
pThread->SetThreadInfo();
CLog::Log(LOGNOTICE,"Thread %s start, auto delete: %s", name.c_str(), (autodelete ? "true" : "false"));
currentThread.set(pThread);
pThread->m_StartEvent.Set();
pThread->OnStartup();
pThread->Process();
pThread->OnExit();
// lock during termination
CSingleLock lock(pThread->m_CriticalSection);
pThread->m_ThreadId = 0;
pThread->m_TermEvent.Set();
pThread->TermHandler();
lock.Leave();
if (autodelete)
{
CLog::Log(LOGDEBUG,"Thread %s %"PRIu64" terminating (autodelete)", name.c_str(), (uint64_t)id);
delete pThread;
pThread = NULL;
}
else
CLog::Log(LOGDEBUG,"Thread %s %"PRIu64" terminating", name.c_str(), (uint64_t)id);
return 0;
}
示例4: setLanguageHook
void LanguageHook::setLanguageHook(LanguageHook* languageHook)
{
TRACE;
languageHook->Acquire();
addonLanguageHookTls.set(languageHook);
}