Пример #1
0
        static void Main(string[] args)
        {
            OddThread  ot  = new OddThread();
            EvenThread et  = new EvenThread();
            Thread     th1 = new Thread(ot.Run);
            Thread     th2 = new Thread(et.Run);

            th1.Start();
            th2.Start();
        }
Пример #2
0
        static void Main(string[] args)
        {
            OddThread  oddNumbers        = new OddThread();
            EvenThread evenNumbers       = new EvenThread();
            Thread     printOddNumbers   = new Thread(oddNumbers.Run);
            Thread     printEventNumbers = new Thread(evenNumbers.Run);

            printOddNumbers.Start();
            printOddNumbers.Join();
            printEventNumbers.Start();
        }