コード例 #1
0
ファイル: Program.cs プロジェクト: pmiriyals/LinkedIn
        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
ファイル: Program.cs プロジェクト: pmiriyals/LinkedIn
 public CellCons(Cell cell, int max)
 {
     this.max = max;
     this.cell = cell;
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: pmiriyals/LinkedIn
 public CellProd(Cell cell, int max)
 {
     this.cell = cell;
     this.max = max;
 }