Public feed
#887544
public class WorkDispatcher
{
object syncBlock = new object();
int dispatchCount = 0;
public void Dispatch(IWorker worker)
{
Console.WriteLine("Locking this");
lock (this.syncBlock)
{
Thread thread = new Thread(worker.DoWork);
Console.WriteLine("Starting a thread to do work.");
dispatchCount++;
Console.WriteLine("Dispatched " + dispatchCount);
thread.Start(this);
Console.WriteLine("Wait for the thread to join.");
thread.Join();
}
Console.WriteLine("Now we DO get here.");
}
}