本文整理汇总了C++中Process::GetRunLock方法的典型用法代码示例。如果您正苦于以下问题:C++ Process::GetRunLock方法的具体用法?C++ Process::GetRunLock怎么用?C++ Process::GetRunLock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process::GetRunLock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: log
const char *
SBFrame::GetFunctionName()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const char *name = NULL;
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = NULL;
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
if (target && process)
{
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process->GetRunLock()))
{
frame = exe_ctx.GetFramePtr();
if (frame)
{
SymbolContext sc (frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol));
if (sc.block)
{
Block *inlined_block = sc.block->GetContainingInlinedBlock ();
if (inlined_block)
{
const InlineFunctionInfo* inlined_info = inlined_block->GetInlinedFunctionInfo();
name = inlined_info->GetName().AsCString();
}
}
if (name == NULL)
{
if (sc.function)
name = sc.function->GetName().GetCString();
}
if (name == NULL)
{
if (sc.symbol)
name = sc.symbol->GetName().GetCString();
}
}
else
{
if (log)
log->Printf ("SBFrame::GetFunctionName () => error: could not reconstruct frame object for this SBFrame.");
}
}
else
{
if (log)
log->Printf ("SBFrame::GetFunctionName() => error: process is running");
}
}
return name;
}
示例2: IsValid
bool SBThread::IsValid() const {
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
if (target && process) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process->GetRunLock()))
return m_opaque_sp->GetThreadSP().get() != NULL;
}
// Without a valid target & process, this thread can't be valid.
return false;
}