19.7. Programmatically Creating Secondary Threads
When you wish to programmatically create additional threads to carry on some unit of work, you will follow a very predictable process:
Create a method to be the entry point for the new thread.
Create a new ParameterizedThreadStart (or ThreadStart) delegate, passing the address of the method defined in step 1 to the constructor.
Create a Thread object, passing the ParameterizedThreadStart/ThreadStart delegate as a constructor argument.
Establish any initial thread characteristics (name, priority, etc.).
Call the Thread.Start() method. This starts the thread at the method referenced by the delegate created in step 2 as soon as possible.
As stated in step 2, you may make use of two distinct delegate ...
Get Pro C# 2010 and the .NET 4 Platform, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.