|
using System;
namespace ThreadPoolComponent
{
class Program
{
static void Main(string[] args)
{
var component = new ThreadPoolComponent();
component.ThreadStarted += new EventHandler<ThreadEventArgs>(component_ThreadStarted);
component.AllThreadsFinished += new EventHandler(component_AllThreadsFinished);
Console.WriteLine("Starting the threads...\n---");
component.Start();
do
{
System.Threading.Thread.Sleep(10);
} while (component.IsRunning);
Console.Write("Press any key... ");
Console.ReadKey(true);
}
static void component_ThreadStarted(object sender, ThreadEventArgs e)
{
Console.WriteLine(string.Format("Thread #{0} says hello.", e.ThreadIndex));
}
static void component_AllThreadsFinished(object sender, EventArgs e)
{
Console.WriteLine("---\nAll threads are finished.");
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.