Thread Sleep : Thread Operation « Thread « VB.Net Tutorial






Imports System.Threading

Module Module1

    Sub TaskA()
        Dim I As Integer
        Thread.Sleep(1000)
        For I = 0 To 250
            System.Console.Write("A")
        Next
    End Sub

    Sub TaskB()
        Dim I As Integer
        Thread.Sleep(500)
        For I = 0 To 250
            System.Console.Write("B")
        Next
    End Sub

    Sub TaskC()
        Dim I As Integer
        Thread.Sleep(100)
        For I = 0 To 250
            System.Console.Write("C")
        Next
    End Sub

    Sub Main()
        Dim A As Thread  = New Thread(AddressOf TaskA)
        Dim B As Thread  = New Thread(AddressOf TaskB)
        Dim C As Thread  = New Thread(AddressOf TaskC)

        A.Start()
        B.Start()
        C.Start()
    End Sub
End Module
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"








23.3.Thread Operation
23.3.1.Thread Sleep
23.3.2.Thread complete event