本文整理汇总了C++中POSIXThread::GetState方法的典型用法代码示例。如果您正苦于以下问题:C++ POSIXThread::GetState方法的具体用法?C++ POSIXThread::GetState怎么用?C++ POSIXThread::GetState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POSIXThread
的用法示例。
在下文中一共展示了POSIXThread::GetState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: thread_list_lock
// ProcessPOSIX override
void
ProcessLinux::StopAllThreads(lldb::tid_t stop_tid)
{
// If a breakpoint occurs while we're stopping threads, we'll get back
// here, but we don't want to do it again. Only the MonitorChildProcess
// thread calls this function, so we don't need to protect this flag.
if (m_stopping_threads)
return;
m_stopping_threads = true;
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
if (log)
log->Printf ("ProcessLinux::%s() stopping all threads", __FUNCTION__);
// Walk the thread list and stop the other threads. The thread that caused
// the stop should already be marked as stopped before we get here.
Mutex::Locker thread_list_lock(m_thread_list.GetMutex());
uint32_t thread_count = m_thread_list.GetSize(false);
for (uint32_t i = 0; i < thread_count; ++i)
{
POSIXThread *thread = static_cast<POSIXThread*>(
m_thread_list.GetThreadAtIndex(i, false).get());
assert(thread);
lldb::tid_t tid = thread->GetID();
if (!StateIsStoppedState(thread->GetState(), false))
m_monitor->StopThread(tid);
}
m_stopping_threads = false;
if (log)
log->Printf ("ProcessLinux::%s() finished", __FUNCTION__);
}
示例2: lock
bool
ProcessPOSIX::IsAThreadRunning()
{
bool is_running = false;
Mutex::Locker lock(m_thread_list.GetMutex());
uint32_t thread_count = m_thread_list.GetSize(false);
for (uint32_t i = 0; i < thread_count; ++i)
{
POSIXThread *thread = static_cast<POSIXThread*>(
m_thread_list.GetThreadAtIndex(i, false).get());
StateType thread_state = thread->GetState();
if (thread_state == eStateRunning || thread_state == eStateStepping)
{
is_running = true;
break;
}
}
return is_running;
}