CHAPTER 19 MULTITHREADED, PARALLEL, AND ASYNC PROGRAMMING
class Program
{
static void Main(string[] args)
{
Console.WriteLine("***** Fun with the CLR Thread Pool *****\n");
Console.WriteLine("Main thread started. ThreadID = {0}",
Thread.CurrentThread.ManagedThreadId);
Printer p = new Printer();
WaitCallback workItem = new WaitCallback(PrintTheNumbers);
}
}
// Queue the method ten times.
for (int i = 0; i < 10; i++)
{
ThreadPool.QueueUserWorkItem(workItem, p)