问题描述
子线程的父线程
假设一个进程创建了一些线程,例如threadC和threadD.
稍后在这些线程中的每个线程上创建新的子线程,例如threadC1,threadC2,threadC3等.因此将创建线程树.
有什么方法可以找出一个这样随机创建的线程的父线程吗?
实际上,当我们的应用程序启动时,会按照
创建70个线程要求.
以后根据需要,这70个线程可以创建更多线程.
因此,除了这70个线程外,还会创建大量其他线程(来自
这70条线)并随机销毁.
想象一下,有一棵线程树.
在这样一个随机创建的线程中出现一个问题.
在调试代码时,我们发现问题是由于其
设置的值引起的父线程.
因此,我们必须找到该错误线程的父线程.
我们无法获得该线程的父线程ID?
有人会让我们知道如何找到这种随机创建的线程的父级吗?
Parent Thread Of Child Thread
Suppose a process creates some threads say threadC and threadD.
Later on each of these threads create new child threads say threadC1, threadC2, threadC3 etc. So a tree of threads will get created.
Is there any way to find out the parent thread of one such randomly created thread?
Actually when our application starts 70 threads gets created which is as per the
requirement.
Later on as per the needs these 70 threads can create more threads.
So apart from these 70 threads a large number of other threads gets created(from
these 70 threads) and destroyed randomly.
So imagine there is a tree of threads.
There is an issue coming up in one such randomly created thread.
On debugging the code we saw that the issue will be due to a value set by its
parent thread.
So we have to find the parent thread of this erroneus thread.
We are not able to get the parent thread id of this thread?
Will anybody let us know how to find the parent of such randomly created threads
using especially windbg/visual studio?
推荐答案
这篇关于子线程的父线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!