Define method and Run inside a Thread
Imports System.Threading
Public Class MainClass
Public Shared Sub Main()
Dim A As Thread = New Thread(AddressOf MethodInThread)
Dim B As Thread = New Thread(AddressOf MethodInThread)
Dim C As Thread = New Thread(AddressOf MethodInThread)
A.Name = "A"
A.Start()
B.Name = "B"
B.Start()
C.Name = "C"
C.Start()
End Sub
Shared Sub MethodInThread()
Dim O As Thread
Dim hash As Integer
O = Thread.CurrentThread
hash = O.GetHashCode()
Console.Write("Thread name: {0}", Thread.CurrentThread.Name)
Console.WriteLine(" Thread hash: {0}", hash.ToString())
End Sub
End Class
Related examples in the same category