how do i open up 8 thread to run 8 function at the same time?
threading
Collapse
This topic is closed.
X
X
-
newbieTags: None -
rawCoder
Re: threading
This is a modified example from MSDN available at
http://msdn.microsoft.com/library/de...StartTopic.asp
Imports System
Imports System.Threadin g
Public Class ThreadWork
Public Shared nCount As Integer = 0
Public Shared Sub DoWork()
Dim nThreadNo As Integer
nCount = nCount + 1
nThreadNo = nCount
Console.WriteLi ne("Thread Starting " & nThreadNo)
Thread.Sleep(nT hreadNo * 50)
Console.WriteLi ne("Thread Exiting " & nThreadNo)
End Sub 'DoWork
End Class 'ThreadWork
Class ThreadTest
Public Shared Sub Main()
Dim myThreadDelegat e As New ThreadStart(Add ressOf ThreadWork.DoWo rk)
Dim myThread As Thread
Dim i As Integer
For i = 1 To 8
myThread = New Thread(myThread Delegate)
myThread.Start( )
Next
Thread.Sleep(10 00)
End Sub 'Main
End Class 'ThreadTest
HTH
rawCoder
"newbie" <newbie@discuss ions.microsoft. com> wrote in message
news:4671FC26-C7B8-4A86-BF50-388C667947F7@mi crosoft.com...[color=blue]
> how do i open up 8 thread to run 8 function at the same time?[/color]
Comment