本文整理汇总了C++中Thread::StoppedReason方法的典型用法代码示例。如果您正苦于以下问题:C++ Thread::StoppedReason方法的具体用法?C++ Thread::StoppedReason怎么用?C++ Thread::StoppedReason使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thread
的用法示例。
在下文中一共展示了Thread::StoppedReason方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetToolTipForTableCell
virtual bool GetToolTipForTableCell(int32 rowIndex, int32 columnIndex,
BToolTip** _tip)
{
Thread* thread = fThreads.ItemAt(rowIndex);
if (thread == NULL)
return false;
BString text;
text << "Thread: \"" << thread->Name() << "\" (" << thread->ID()
<< ")\n";
switch (thread->State()) {
case THREAD_STATE_RUNNING:
text << "Running";
break;
case THREAD_STATE_STOPPED:
{
switch (thread->StoppedReason()) {
case THREAD_STOPPED_DEBUGGER_CALL:
text << "Called debugger(): "
<< thread->StoppedReasonInfo();
break;
case THREAD_STOPPED_EXCEPTION:
text << "Caused exception: "
<< thread->StoppedReasonInfo();
break;
case THREAD_STOPPED_BREAKPOINT:
case THREAD_STOPPED_WATCHPOINT:
case THREAD_STOPPED_SINGLE_STEP:
case THREAD_STOPPED_DEBUGGED:
case THREAD_STOPPED_UNKNOWN:
default:
text << "Stopped for debugging";
break;
}
break;
}
case THREAD_STATE_UNKNOWN:
default:
text << "Current State Unknown";
break;
}
BTextToolTip* tip = new(std::nothrow) BTextToolTip(text);
if (tip == NULL)
return false;
*_tip = tip;
return true;
}
示例2: GetValueAt
virtual bool GetValueAt(int32 rowIndex, int32 columnIndex, BVariant& value)
{
Thread* thread = fThreads.ItemAt(rowIndex);
if (thread == NULL)
return false;
switch (columnIndex) {
case 0:
value.SetTo(thread->ID());
return true;
case 1:
{
switch (thread->State()) {
case THREAD_STATE_RUNNING:
value.SetTo("Running", B_VARIANT_DONT_COPY_DATA);
return true;
case THREAD_STATE_STOPPED:
break;
case THREAD_STATE_UNKNOWN:
default:
value.SetTo("?", B_VARIANT_DONT_COPY_DATA);
return true;
}
// thread is stopped -- get the reason
switch (thread->StoppedReason()) {
case THREAD_STOPPED_DEBUGGER_CALL:
value.SetTo("Call", B_VARIANT_DONT_COPY_DATA);
return true;
case THREAD_STOPPED_EXCEPTION:
value.SetTo("Exception", B_VARIANT_DONT_COPY_DATA);
return true;
case THREAD_STOPPED_BREAKPOINT:
case THREAD_STOPPED_WATCHPOINT:
case THREAD_STOPPED_SINGLE_STEP:
case THREAD_STOPPED_DEBUGGED:
case THREAD_STOPPED_UNKNOWN:
default:
value.SetTo("Debugged", B_VARIANT_DONT_COPY_DATA);
return true;
}
}
case 2:
value.SetTo(thread->Name(), B_VARIANT_DONT_COPY_DATA);
return true;
default:
return false;
}
}