static void Main(string[] args)
        {
            BlockingCollection<int> _buffer = new BlockingCollection<int>(40);
            BlockingCollection<int> _buffer2 = new BlockingCollection<int>(40);

            Producer prod = new Producer(_buffer, 40);

            Consumer con = new Consumer(_buffer2);
            Middleman mid = new Middleman(_buffer, _buffer2);

            Parallel.Invoke(prod.Run, con.Run, mid.Run);
            
        }
Exemplo n.º 2
0
 public static void Main(string[] args)
 {
     int length = 10;
     BoundedBuffer testedBuffer = new BoundedBuffer(length);
     Producer p1 = new Producer(testedBuffer,15,1);
     Producer p2 = new Producer(testedBuffer, 15, 2);
     Consumer c1 = new Consumer(testedBuffer);
     p2.run();
     p1.run();
     c1.run();
     Thread.Sleep(1000);
     p1.stop();
     p2.stop();
     c1.stop();
     Console.ReadKey();
 }