Пример #1
0
        public static void PrintNumbers()
        {
            var monitor = new SynchronizeThreadsMonitor();
            var t1      = new OddThread(monitor);
            var t2      = new EvenThread(monitor);

            t1.Start();
            t2.Start();
            t1.Join();
            t2.Join();
        }
Пример #2
0
 public EvenThread(SynchronizeThreadsMonitor monitor)
 {
     this.monitor = monitor;
     thread       = new Thread(new ThreadStart(this.Run));
 }