472,127 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

List of running threads by name

I'm looking for a way to find a specific running thread by name. I came across the System.Diagnostics.Process.Threads collection but unfortunately, this collection holds ProcessThread objects which don't provide the thread's friendly name.

I expected to find something like that in System.AppDomain. But while there is a CurrentThread property, this class lacks any sort of collection for all running threads.

I am pretty sure that there's something like what I'm looking for. However, the debugger is able to display friendly names for each thread and so is e.g. CodeSite.

Does anybody know a hook within .NET 2.0 where to find a list of running threads with friendly names?
Jan 15 '07 #1
5 10012
kenobewan
4,871 Expert 4TB
Try System.Diagnostics.Process.GetCurrentProcess.Threa ds...

Hope that this helps.
Jan 16 '07 #2
I've come across that hook already. Unfortunately, this collection returns instances of type "ProcessThread" and this class doesn't hold the thread's name.

Maybe there's a way to obtain the friendly name for a ProcessThread instance?
Jan 16 '07 #3
kenobewan
4,871 Expert 4TB
Try System.Diagnostics.Process.GetCurrentProcess().Pro cessName; but just seen an opinion that the name of threads can't be obtained:
Grokking Active Threads
Jan 17 '07 #4
The referenced article states that there might not be a way to get friendly names for unmanaged threads. That doesn't matter to me since I just need a named list of managed threads for my own AppDomain.

The ProcessName is not really what I'm looking for, though.
Jan 22 '07 #5
kenobewan
4,871 Expert 4TB
Sorry that I couldn't help, but found 2 more articles that may be worth a look:
Using Diagnostic Classes In The .NET SDK
.NET Diagnostics - II, A Threads Monitoring Application Using C#
Jan 23 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Bart Nessux | last post: by
1 post views Thread by John | last post: by
1 post views Thread by Al Sav | last post: by
4 posts views Thread by sneffe | last post: by
reply views Thread by PromisedOyster | last post: by
6 posts views Thread by garther | last post: by
1 post views Thread by Lagon666 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.