Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Displaying the thread ID

Posted on 2009-05-05
3
Medium Priority
?
522 Views
Last Modified: 2012-05-06
Experts,

How does one display the thread ID for identifying what tasks are running in a thread?
0
Comment
Question by:nickmarshall
  • 2
3 Comments
 
LVL 6

Assisted Solution

by:ViceroyFizzlebottom
ViceroyFizzlebottom earned 1000 total points
ID: 24305636
Thread.CurrentThread.Name
0
 
LVL 6

Assisted Solution

by:ViceroyFizzlebottom
ViceroyFizzlebottom earned 1000 total points
ID: 24305663
Or actually, more specific to your question:
Thread.CurrentThread.GetHashCode();

Here's a good article on threading in .NET:
http://www.code-magazine.com/Article.aspx?quickid=0309071
0
 
LVL 9

Accepted Solution

by:
tculler earned 1000 total points
ID: 24306242
What thread are you looking to get the ID for? You can use the ManagedThreadID instance property of any Thread object, the Name instance property, or GetHashCode() should work as well.

If you're looking to get the Threads in a certain process, create an instance of a System.Diagnostics.Process object that is linked to that process, and use the "Threads" instance property. This returns a collection of the Threads currently running in that given process. If you want the threads in the current process, call System.Diagnostics.Process.GetCurrentProcess().Threads.

Hope I helped,
Nate
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question