Mega Code Archive

 
Categories / VB.Net Tutorial / Thread
 

Queue a simple task, represented by the ThreadProc method, using the QueueUserWorkItem method

Imports System Imports System.Threading Public Class Example     Public Shared Sub Main()         ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf ThreadProc))         Thread.Sleep(1000)     End Sub     Shared Sub ThreadProc(stateInfo As Object)         Console.WriteLine("Hello from the thread pool.")     End Sub End Class