473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Getting physical thread Id

Hello,
Does anyone know how to get the current thread's ID
in .Net (e.g., for logging purposes)?
The Thread class doesn't have thread Id member. There is
the Process.Threads property, which returns collection of
ProcessThread objects which have IDs, but then how do you
find out which one of them is the current thread?
Thanks,
Hayk
Jul 19 '05 #1
2 4764
Please not that I want to avoid using Win32 API
functions...
Hayk
-----Original Message-----
Hello,
Does anyone know how to get the current thread's ID
in .Net (e.g., for logging purposes)?
The Thread class doesn't have thread Id member. There is
the Process.Threads property, which returns collection of
ProcessThread objects which have IDs, but then how do you
find out which one of them is the current thread?
Thanks,
Hayk
.

Jul 19 '05 #2
The Thread class doesn't have thread Id member.


But it does have the GetHashCode() which is good enough for most
purposes.

There's also the AppDomain.GetCurrentThreadId() method.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Jul 19 '05 #3

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

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
2
by: Michał Januszczyk | last post by:
Is there any _managed_ way of getting total physical memory installed in the machine Thanks in advanc Michał Januszczyk
11
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the...
2
by: Sakharam | last post by:
Hi All, I am developing a scheduler object for my web application. I am starting new thread on Application_Start event. Everything works fine except following issue. I am using following...
1
by: Raed Sawalha | last post by:
I have a problem in getting asp.net application physical path in global.ascx static function in my global.ascx i have a static function : first i tried to get the physical path by refelection...
8
by: bryan | last post by:
Is there any way I can get the application path (the one returned by Request.ApplicationPath) in the Application_Start method in Global.asax? Request is not valid there. On a related note, is there...
4
by: JackRazz | last post by:
Is there a way to get a components parent form from within the component? Thanks - JackRazz
2
by: Hayk | last post by:
Hello, Does anyone know how to get the current thread's ID in .Net (e.g., for logging purposes)? The Thread class doesn't have thread Id member. There is the Process.Threads property, which...
1
by: Pioneer | last post by:
Hi, I need to get MAC address/physical ip address of machine. I am using below code: ManagementClass mc = new ManagementClass("Win32_NetworkAdapter"); foreach (ManagementObject mo in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.