static void Main(string[] args) { //Create the MonitorSample object. MonitorSample test = new MonitorSample(); //Create the first thread. Thread tFirst = new Thread(new ThreadStart(test.FirstThread)); //Create the second thread. Thread tSecond = new Thread(new ThreadStart(test.SecondThread)); //Start threads. tFirst.Start(); tSecond.Start(); //wait to the end of the two threads tFirst.Join(); tSecond.Join(); //Print the number of queue elements. Console.WriteLine("Queue Count = " + test.GetQueueCount().ToString()); }
void Main(string[] args) { //Create the MonitorSample object. MonitorSample test = new MonitorSample(); //Create the first thread. Thread tFirst = new Thread(new ThreadStart(test.FirstThread)); //Create the second thread. Thread tSecond = new Thread(new ThreadStart(test.SecondThread)); //Start threads. tFirst.IsBackground = false; tSecond.IsBackground = false; tFirst.Start(); tSecond.Start(); //wait to the end of the two threads //tFirst.Join(); //tSecond.Join(); //Print the number of queue elements. Console.WriteLine("Queue Count = " + test.GetQueueCount().ToString()); Console.Read(); }