Пример #1
0
        static void Main(string[] args)
        {
            Cell cell = new Cell();
            CellCons consumer = new CellCons(cell, 20);
            CellProd producer = new CellProd(cell, 20);

            Thread Tcons = new Thread(new ThreadStart(consumer.consume));
            Thread Tprod = new Thread(new ThreadStart(producer.produce));
            try
            {
                Tcons.Start();
                Tprod.Start();

                Tprod.Join();
                Tcons.Join();
            }
            catch (ThreadStateException ex)
            {
                Console.WriteLine("ThreadStartEx in Main: " + ex.Message);
            }
            Console.ReadLine();
        }
Пример #2
0
 public CellCons(Cell cell, int max)
 {
     this.max = max;
     this.cell = cell;
 }
Пример #3
0
 public CellProd(Cell cell, int max)
 {
     this.cell = cell;
     this.max = max;
 }