Listing Threads in .Net (Full Version)

All Forums >> [Scripting Technologies] >> General Scripting



Message


Shak -> Listing Threads in .Net (6/12/2008 2:53:03 PM)

Hi Guys,

I'll try and explain this the best way i can.

In my code i'm creating and calling a thread everytime its needed. The thread name is always the same though ofcourse each launched thread has a new ThreadID.

I want to have an option to KILL individual threads when need be. How can list these created threads? System.Diagnostics.Process.GetProcess.Threads works but the threads IDs returned by it are different from the ones i recorded when starting the thread. And for every thread started, internally 6 or more threads are created and therefore i cannot use "System.Diagnostics.Process.GetProcess.Threads " because i have no way to diffrentiate between the thread i want to kill and the ones that belong to the system.

Any help/pointer is much appreciated.

Regards,
Shak




Philbert -> RE: Listing Threads in .Net (7/7/2008 12:40:12 AM)

I'd just hold references to the created threads in a hashtable (or dictionary) as they're created, then limit the threads that the user can to the threads that are contained in that table.

Would that accomplish your goal?




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.203125