How can you force new objects to be created on new threads?
The CreateThread function creates a thread to execute within the virtual address space of the calling process.
To create a thread that runs in the virtual address space of another process Creating a new thread is as easy as declaring it and supplying it with a delegate to the method where the thread is to start. When you are ready to begin execution on the thread, call the Thread.Start Method. There are special considerations involved when working with multiple threads of execution.
To create a new thread of execution
====================================
Declare the thread.
******************
‘ Visual Basic
Dim myThread as System.Threading.Thread
// C#
System.Threading.Thread myThread;
Instantiate the thread with the appropriate delegate for the starting point of the thread. Use the AddressOf operator to create the delegate
in Visual Basic, or create a new ThreadStart object in C#.
*******************
‘ Visual Basic
myThread = New System.Threading.Thread(AddressOf
myStartingMethod)
// C#
myThread = new System.Threading.Thread(new
System.Threading.ThreadStart(myStartingMethod));
call the Thread.Start method to start the thread.
*******************
‘ Visual Basic
myThread.Start()
// C#
myThread.Start();