vb.net How can I tell what the current thread is
Posted on 2013-05-13
I am using the following logic to determine what the current thread is but the code is not working.
I should hit the if statement and set the isCurrent text if I find the current thread. What is wrong with my code?
Dim proc As Process = Process.GetCurrentProcess()
Dim thread As ProcessThread = Nothing
Dim isCurrent As String = ""
For Each thread In proc.Threads
If System.Threading.Thread.CurrentThread Is thread Then
isCurrent = "Current_thread: "
logmessage(isCurrent & "thread id = " & thread.Id & _
" thread.CurrentPriority = " & thread.CurrentPriority)