本文整理汇总了C++中Thread::GetId方法的典型用法代码示例。如果您正苦于以下问题:C++ Thread::GetId方法的具体用法?C++ Thread::GetId怎么用?C++ Thread::GetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thread
的用法示例。
在下文中一共展示了Thread::GetId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void EventCallbackBase::PrintCallstacksX64( IProcess* process )
{
Enumerator<Thread*>* threads = NULL;
process->EnumThreads( threads );
while ( threads->MoveNext() )
{
Thread* t = threads->GetCurrent();
std::list<FrameX64> stack;
ReadCallstackX64( process->GetHandle(), t->GetHandle(), stack );
printf( " TID=%d\n", t->GetId() );
for ( std::list<FrameX64>::iterator it = stack.begin();
it != stack.end();
it++ )
{
printf( " RIP=%016x, RBP=%016x\n", it->Rip, it->Rbp );
}
}
threads->Release();
}
示例2: DumpThreads
void Scheduler::DumpThreads(BaseDebugOutputDevice* c)
{
for(Thread* curThread = listHead; curThread != NULL; curThread = curThread->next)
{
*c << "SCHEDULER: " << "\tThread ID: " << dec << curThread->GetId() << endl;
*c << "SCHEDULER: " << "\tThread Name: " << curThread->GetName() << endl;
*c << "SCHEDULER: " << "\tInstruction Pointer: " << hex << curThread->GetInstructionPointer() << endl;
*c << "SCHEDULER: " << "\tStack Pointer: " << curThread->GetStackPointer() << endl;
*c << "SCHEDULER: " << "\tBase Pointer: " << curThread->GetFramePointer() << endl;
*c << "SCHEDULER: " << "\tTimeslice: " << dec << curThread->GetTimeslice() << endl;
*c << endl;
}
}
示例3: ResumeThread
inline DWORD ResumeThread(Thread const& thread)
{
HADESMEM_DETAIL_TRACE_FORMAT_A("Resuming thread with ID 0n%lu.",
thread.GetId());
DWORD const suspend_count = ::ResumeThread(thread.GetHandle());
if (suspend_count == static_cast<DWORD>(-1))
{
DWORD const last_error = ::GetLastError();
HADESMEM_DETAIL_THROW_EXCEPTION(Error()
<< ErrorString("ResumeThread failed.")
<< ErrorCodeWinLast(last_error));
}
return suspend_count;
}
示例4: GetThreadContext
inline CONTEXT GetThreadContext(Thread const& thread, DWORD context_flags)
{
if (::GetCurrentThreadId() == thread.GetId() &&
context_flags != CONTEXT_DEBUG_REGISTERS)
{
HADESMEM_DETAIL_THROW_EXCEPTION(
Error() << ErrorString("GetThreadContext called for current thread."));
}
CONTEXT context{};
context.ContextFlags = context_flags;
if (!::GetThreadContext(thread.GetHandle(), &context))
{
DWORD const last_error = ::GetLastError();
HADESMEM_DETAIL_THROW_EXCEPTION(Error()
<< ErrorString("GetThreadContext failed.")
<< ErrorCodeWinLast(last_error));
}
return context;
}