Thread ID for current thread
-
for logging purposes, I need to be able to determine the thread ID of the currently executing thread. I've discovered that I can pretty easily get the thread ID from the ProcessThread class. What I can't figure out is how to determine which ProcessThread corresponds to System.Threading.Thread.CurrentThread. Any tips on how to get the ID that I'm looking for? BTW, I've already tried using Thread.CurrentThread.GetHashCode(). While it seems to work (unique numbers), a comparison to the ProcessThread IDs in the app makes it perfectly clear that there's no direct correlation.
Grim
(aka Toby)
MCDBA, MCSD, MCP+SB
-
for logging purposes, I need to be able to determine the thread ID of the currently executing thread. I've discovered that I can pretty easily get the thread ID from the ProcessThread class. What I can't figure out is how to determine which ProcessThread corresponds to System.Threading.Thread.CurrentThread. Any tips on how to get the ID that I'm looking for? BTW, I've already tried using Thread.CurrentThread.GetHashCode(). While it seems to work (unique numbers), a comparison to the ProcessThread IDs in the app makes it perfectly clear that there's no direct correlation.
Grim
(aka Toby)
MCDBA, MCSD, MCP+SB
-
I used the following two: System.Diagnositics.ProcessThread Id Property AppDomain.GetCurrentThreadId() The former is OS Thread ( so Process) The latter is CLR Thread ( so AppDomain) Is that what you are look for ? Any other ways ?? James