可用线程列表 [英] Listing of available threads

查看:69
本文介绍了可用线程列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法找到在

项目中运行的所有线程名称?


例如,如果我有5个线程T1, T2,T3,T4,T5 ......和T2,T4和

T5正在运行...我希望能够知道T2,T4和T5是

已经在运行。


谢谢,

Darian

Is there a way to find all the thread names that are running in a
project?

For example, if I have 5 threads T1, T2, T3, T4, T5...and T2, T4, and
T5 are running...I want to be able to know that T2, T4 and T5 are
already running.

Thanks,
Darian

推荐答案

On 2004年9月7日06:42:59 -0700,Darian写道:
On 7 Sep 2004 06:42:59 -0700, Darian wrote:
有没有办法找到在
项目中运行的所有线程名称?

例如,如果我有5个线程T1,T2,T3,T4,T5 ......和T2,T4和
T5正在运行......我希望能够知道T2 ,T4和T5已经运行了。

谢谢,
Darian
Is there a way to find all the thread names that are running in a
project?

For example, if I have 5 threads T1, T2, T3, T4, T5...and T2, T4, and
T5 are running...I want to be able to know that T2, T4 and T5 are
already running.

Thanks,
Darian




您可以使用System.Diagnostics .Process类'的Threads成员访问

您的流程线程 - 您无法从那里获得名称

虽然......


-

Tom Shelton [MVP]



You can use the System.Diagnostics.Process class''s Threads member to access
your process threads - You won''t be able to get the name from there
though...

--
Tom Shelton [MVP]


Darian,


就像大多数人一样,只需设置一个布尔数组然后将其设置为true

类似

private threadrunnunning(5)as boolean


threadrunning(1)= true

如果threadrunning(1)= true那么


在我看来,这给你带来的性能远远超过检查

其他方法。


只是我的想法,


Cor


Darian
Darian,

Do it like most people, just set a boolean array for it and set that to true
something like
private threadrunnunning(5) as boolean

threadrunning(1) = true
if threadrunning(1) = true then

That gives you in my opinion real much more performance than checking it
with any other method.

Just my thought,

Cor

"Darian"
有没有办法找到在
项目中运行的所有线程名称?

例如,如果我有5个线程T1,T2 ,T3,T4,T5 ......和T2,T4和
T5正在运行...我希望能够知道T2,T4和T5已经在运行。

谢谢,
Darian
Is there a way to find all the thread names that are running in a
project?

For example, if I have 5 threads T1, T2, T3, T4, T5...and T2, T4, and
T5 are running...I want to be able to know that T2, T4 and T5 are
already running.

Thanks,
Darian



您可以使用Process.Threads属性。在返回的集合上,使用单个元素上的

ThreadState属性来过滤掉正在运行的线程

(对于ThreadState.Running)。


希望这就是你要找的东西。


Darian <哒*********** @ lmicorporation.com>在消息中写道

news:fa ************************* @ posting.google.co m ...

有没有办法找到在

项目中运行的所有线程名称?


例如,如果我有5个线程T1,T2,T3,T4,T5 ......和T2,T4和

T5正在运行...我希望能够知道T2,T4和T5是

已经在运行。


谢谢,

Darian
You may use Process.Threads property. On the returned collection, use the
ThreadState property on individual elements to filter out running threads
(for ThreadState.Running).

Hope this is what you are looking for.

"Darian" <da***********@lmicorporation.com> wrote in message
news:fa*************************@posting.google.co m...
Is there a way to find all the thread names that are running in a
project?

For example, if I have 5 threads T1, T2, T3, T4, T5...and T2, T4, and
T5 are running...I want to be able to know that T2, T4 and T5 are
already running.

Thanks,
Darian


这篇关于可用线程列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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