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


C++ ThreadContext::GetThreadId方法代码示例

本文整理汇总了C++中ThreadContext::GetThreadId方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadContext::GetThreadId方法的具体用法?C++ ThreadContext::GetThreadId怎么用?C++ ThreadContext::GetThreadId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ThreadContext的用法示例。


在下文中一共展示了ThreadContext::GetThreadId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ThreadContext

ThreadContext& DebugThreadManager::StartThread(const Common::StackPreparator& stack, size_t stackSize, const PEF::TransitionVector& entryPoint, bool startNow)
{
	// lldb enforces some alignment constraints on the stack, so align it correctly by allocating some additional memory
	ThreadContext* context = new ThreadContext(allocator, nextId, stackSize + 0x200);
	uint32_t stackAddress = allocator.ToIntPtr(*context->stack);
	stackAddress += 0x200;
	stackAddress &= ~0x1ff;
	auto info = stack.WriteStack(allocator.ToPointer<char>(stackAddress), stackAddress, stackSize);
	context->machineState.r1 = allocator.ToIntPtr(info.sp);
	context->machineState.r2 = entryPoint.TableOfContents;
	context->machineState.r3 = context->machineState.r27 = info.argc;
	context->machineState.r4 = context->machineState.r28 = allocator.ToIntPtr(info.argv);
	context->machineState.r5 = context->machineState.r29 = allocator.ToIntPtr(info.envp);
	context->machineState.lr = allocator.ToIntPtr(context->interpreter.GetEndAddress());
	context->pc = entryPoint.EntryPoint;
	
	context->thread = std::thread(&DebugThreadManager::DebugLoop, this, std::ref(*context), startNow);
	
	// this should stay at the end of the method or be scoped
	std::lock_guard<std::mutex> lock(threadsLock);
	threads[context->GetThreadId()].reset(context);
	nextId += 0x10;
	
	return *context;
}
开发者ID:jjuran,项目名称:classix,代码行数:25,代码来源:DebugThreadManager.cpp


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