Example #1
0
        static void Main(string[] args)
        {
            BoundedBuffer buf = new BoundedBuffer(4);

            Producer prod = new Producer(buf, 100);

            Consumer con = new Consumer(buf);

            Parallel.Invoke(prod.run() , con.run());
        }
Example #2
0
        public static void Main(string[] args)
        {
            BoundedBuffer bf = new BoundedBuffer(8);
            Producer producer = new Producer(bf,200);
            Consumer consumer = new Consumer(bf);
            Consumer consumer2 = new Consumer(bf);
            Thread pt = new Thread(producer.Run);
            Thread ct = new Thread(consumer.Run);
            Thread ct2 = new Thread(consumer2.Run);
            pt.Start();
            ct.Start();
            ct2.Start();




        }