本文整理汇总了C++中POSIXThread::Notify方法的典型用法代码示例。如果您正苦于以下问题:C++ POSIXThread::Notify方法的具体用法?C++ POSIXThread::Notify怎么用?C++ POSIXThread::Notify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POSIXThread
的用法示例。
在下文中一共展示了POSIXThread::Notify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
void
ProcessPOSIX::RefreshStateAfterStop()
{
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
log->Printf ("ProcessPOSIX::%s(), message_queue size = %d", __FUNCTION__, (int)m_message_queue.size());
Mutex::Locker lock(m_message_mutex);
// This method used to only handle one message. Changing it to loop allows
// it to handle the case where we hit a breakpoint while handling a different
// breakpoint.
while (!m_message_queue.empty())
{
ProcessMessage &message = m_message_queue.front();
// Resolve the thread this message corresponds to and pass it along.
lldb::tid_t tid = message.GetTID();
if (log)
log->Printf ("ProcessPOSIX::%s(), message_queue size = %d, pid = %" PRIi64, __FUNCTION__, (int)m_message_queue.size(), tid);
if (message.GetKind() == ProcessMessage::eNewThreadMessage)
{
if (log)
log->Printf ("ProcessPOSIX::%s() adding thread, tid = %" PRIi64, __FUNCTION__, message.GetChildTID());
lldb::tid_t child_tid = message.GetChildTID();
ThreadSP thread_sp;
thread_sp.reset(CreateNewPOSIXThread(*this, child_tid));
Mutex::Locker lock(m_thread_list.GetMutex());
m_thread_list.AddThread(thread_sp);
}
m_thread_list.RefreshStateAfterStop();
POSIXThread *thread = static_cast<POSIXThread*>(
GetThreadList().FindThreadByID(tid, false).get());
if (thread)
thread->Notify(message);
if (message.GetKind() == ProcessMessage::eExitMessage)
{
// FIXME: We should tell the user about this, but the limbo message is probably better for that.
if (log)
log->Printf ("ProcessPOSIX::%s() removing thread, tid = %" PRIi64, __FUNCTION__, tid);
Mutex::Locker lock(m_thread_list.GetMutex());
ThreadSP thread_sp = m_thread_list.RemoveThreadByID(tid, false);
thread_sp.reset();
m_seen_initial_stop.erase(tid);
}
m_message_queue.pop();
}
}