Thread priority: Highest and normal
Imports System
Imports System.Threading
Imports System.Text
Imports System.Windows.Forms
Public Class MainClass
Public Shared Sub Main()
Dim bThreadStart As New ThreadStart(AddressOf SubtractFromCounter)
Dim bThread As New Thread(bThreadStart)
bThread.Priority = ThreadPriority.Highest
bThread.Start()
Dim i As Integer
Do While True
Console.WriteLine("In main thread and count is " & i)
i += 1
Loop
End Sub
Shared Public Sub SubtractFromCounter()
Dim count As Integer
Do While True
count -= 1
Console.WriteLine("Am in another thread and counter =" _
& count)
Loop
End Sub
End Class
Related examples in the same category