本文整理汇总了C++中ThreadLocal::initialized方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadLocal::initialized方法的具体用法?C++ ThreadLocal::initialized怎么用?C++ ThreadLocal::initialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadLocal
的用法示例。
在下文中一共展示了ThreadLocal::initialized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: autoLock
BackgroundHangThread*
BackgroundHangThread::FindThread()
{
if (sTlsKey.initialized()) {
// Use TLS if available
return sTlsKey.get();
}
// If TLS is unavailable, we can search through the thread list
RefPtr<BackgroundHangManager> manager(BackgroundHangManager::sInstance);
MOZ_ASSERT(manager, "Creating BackgroundHangMonitor after shutdown");
PRThread* threadID = PR_GetCurrentThread();
// Lock thread list for traversal
MonitorAutoLock autoLock(manager->mLock);
for (BackgroundHangThread* thread = manager->mHangThreads.getFirst();
thread; thread = thread->getNext()) {
if (thread->mThreadID == threadID) {
return thread;
}
}
// Current thread is not initialized
return nullptr;
}