473,324 Members | 2,501 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,324 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 4761
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.