当前位置: 首页>>代码示例>>C++>>正文


C++ Thread::GetId方法代码示例

本文整理汇总了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();
}
开发者ID:Stretto,项目名称:mago,代码行数:25,代码来源:EventCallbackBase.cpp

示例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;
    }
}
开发者ID:ajgappmark,项目名称:GeexOS,代码行数:14,代码来源:Scheduler.cpp

示例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;
}
开发者ID:geota,项目名称:hadesmem,代码行数:16,代码来源:thread_helpers.hpp

示例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;
}
开发者ID:geota,项目名称:hadesmem,代码行数:21,代码来源:thread_helpers.hpp


注:本文中的Thread::GetId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。