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(); }
public CellCons(Cell cell, int max) { this.max = max; this.cell = cell; }
public CellProd(Cell cell, int max) { this.cell = cell; this.max = max; }