.NET有没有办法让父线程ID? [英] .NET Is there a way to get the parent thread id?

查看:108
本文介绍了.NET有没有办法让父线程ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设主线程生成一个新的线程T1,怎么能说我在T1运行code找到主线程的线程ID(使用C#)?

Suppose the main thread is spawning a new thread t1, how can my code that runs on t1 find the thread id of the main thread (using c#)?

编辑:
我不控制设立新的线程。因此,我不能传递任何参数给线程。


I don't control the creation of the new thread. So I can't pass any parameters to the thread.

感谢。

推荐答案

您不能。

然而,你可能会考虑:

  1. preFIX从父线程的线程ID的新线程的名称
  2. 创建您要产卵的方法构造需要从父
  3. 线程ID

这篇关于.NET有没有办法让父线程ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆