VB.Net Tutorial/Thread/Thread Creation — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:56, 26 мая 2010
Shows multiple threads that print message
Imports System.Threading
Module Tester
Sub Main()
Dim thread1 As New Thread(AddressOf Print)
Dim thread2 As New Thread(AddressOf Print)
Dim thread3 As New Thread(AddressOf Print)
thread1.Name = "thread1"
thread2.Name = "thread2"
thread3.Name = "thread3"
Console.WriteLine("Starting threads")
thread1.Start()
thread2.Start()
thread3.Start()
End Sub
Public Sub Print()
Dim current As Thread = Thread.CurrentThread
Console.WriteLine(current.Name & " done sleeping")
End Sub
End Module
Starting threads thread1 done sleeping thread3 done sleeping thread2 done sleeping