473,508 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enumerating managed threads

Does anyone know how to enumerate the managed threads in the current
process?
Process.Threads gives you a list of ProcessThreads, but I want to somehow
get a list of the managed threads...

--
John Wood
Blog: http://spaces.msn.com/members/johnwood/

Nov 16 '05 #1
5 5481

John Wood wrote:
Does anyone know how to enumerate the managed threads in the current
process?
Process.Threads gives you a list of ProcessThreads, but I want to somehow get a list of the managed threads...


I'd like to know that as well. I'm not aware of any
straight forward way to do that, and it would very
helpful in debugging deadlocks (as a thread dump in
Java is.) Alternatively, you can register all the
threads you create with a manager of your own. You'd
also need to monitor if the threads are alive so you
don't retain them unnecessarily.

Jose Solorzano

Nov 16 '05 #2
Yeah registering them as you go is what I'm doing as a workaround... just
would be neater without having to do that.

Thanks for your insight though.

--
John Wood
Blog: http://spaces.msn.com/members/johnwood/
"Jose Solorzano" <jh******@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...

John Wood wrote:
Does anyone know how to enumerate the managed threads in the current
process?
Process.Threads gives you a list of ProcessThreads, but I want to

somehow
get a list of the managed threads...


I'd like to know that as well. I'm not aware of any
straight forward way to do that, and it would very
helpful in debugging deadlocks (as a thread dump in
Java is.) Alternatively, you can register all the
threads you create with a manager of your own. You'd
also need to monitor if the threads are alive so you
don't retain them unnecessarily.

Jose Solorzano

Nov 16 '05 #3
Process.Threads returns a list of managed threads associated with a OS
thread, unmanaged threads (non CLR) are not returned in the collection.

Willy.

"John Wood" <sp**@isannoying.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Does anyone know how to enumerate the managed threads in the current
process?
Process.Threads gives you a list of ProcessThreads, but I want to somehow
get a list of the managed threads...

--
John Wood
Blog: http://spaces.msn.com/members/johnwood/

Nov 16 '05 #4
But there seems to be no relationship between a ProcessThread and a
Thread... is there any way to get a Thread instance from a ProcessThread?

Thanks for your insight.

--
John Wood
Blog: http://spaces.msn.com/members/johnwood/
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:ex**************@tk2msftngp13.phx.gbl...
Process.Threads returns a list of managed threads associated with a OS
thread, unmanaged threads (non CLR) are not returned in the collection.

Willy.

"John Wood" <sp**@isannoying.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Does anyone know how to enumerate the managed threads in the current
process?
Process.Threads gives you a list of ProcessThreads, but I want to somehow get a list of the managed threads...

--
John Wood
Blog: http://spaces.msn.com/members/johnwood/


Nov 16 '05 #5
John Wood wrote:
But there seems to be no relationship between a ProcessThread and a
Thread... is there any way to get a Thread instance from a ProcessThread?

Thanks for your insight.


Perhaps there's other ways to do what you want to accomplish ? What is
the goal of this code ?

--
Lasse Vågsæther Karlsen
http://www.vkarlsen.no/
mailto:la***@vkarlsen.no
PGP KeyID: 0x0270466B
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8343
by: Brian P. Bailey | last post by:
Hello, I'm trying to enumerate the fixed-pitch font families installed on a system. I am _not_ trying to create a generic monospaced font. I've tried looking at: FontFamily...
5
3958
by: | last post by:
Hi I have thread that recives event notifications from a server. the thread is created as a managed thread. But when using Thread Abort the thread doesn't terminate. the thread is in an...
3
22152
by: bygandhi | last post by:
Hi - I am writing a service which will check a process and its threads for their state ( alive or dead ). The process has 5 .net managed threads created using thread.start and each have been...
2
7247
by: asanford | last post by:
We use StackWalk(StackWalk64) from dbghelp.dll to walk our callstacksas needed, using the various Sym* methods (SymGetSymFromAddr, SymGetLineFromAddr) to resolve source file, function name, and...
3
2755
by: Thorsten | last post by:
HI I'm a C# developer and unfortunately I have to write now some code in managed and unmanaged C++. In this area I'm Newbie and therefore please forgive me if this is a really simple...
2
4553
by: Tony | last post by:
I have this problem - I have a hashtable, containing a list of filenames. Every 60 seconds, I have a thread that enumerates thru this hashtable, and based on some simple logic, some of the items...
3
3657
by: Lonewolf | last post by:
Hi all, I'm having difficulties passing data back to managed class from my native class when the data is generated from within a native thread in the native class itself. I will give the following...
1
1595
by: niclester | last post by:
Hello, I am trying to obtain a safe correlation between a managed thread and a WIn32 thread. I need to be able to gather run time statistics on particular running threads using WMI or...
20
2271
by: =?Utf-8?B?VGhlTWFkSGF0dGVy?= | last post by:
Sorry to bring up a topic that is just flogging a dead horse.... but... On the topic of memory management.... I am doing some file parcing that has to be done as quick as posible, but what I...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.