//PrinterThread prints the current bucket contents static void PrinterThread() { while (true) { Thread.Sleep(50); //Only print every few milliseconds to let the other threads work TSBs.PrintBuckets(); } }
public static void Main() { //Create the thread-safe bucket list TSBs = new ThreadSafeBuckets(10); TSBs.PrintBuckets(); //Create and start the Equalizing Thread new Thread(new ThreadStart(EqualizerThread)).Start(); Thread.Sleep(1); //Create and start the Randamizing Thread new Thread(new ThreadStart(RandomizerThread)).Start(); //Use this thread to do the printing PrinterThread(); }
public static void Main() { //Create the thread-safe bucket list TSBs = new ThreadSafeBuckets(10); TSBs.PrintBuckets(); //Create and start the Equalizing Thread new Thread(new ThreadStart(EqualizerThread)).Start(); Thread.Sleep(1); //Create and start the Randamizing Thread new Thread(new ThreadStart(RandomizerThread)).Start(); //Use this thread to do the printing PrinterThread(); }