예제 #1
0
        public Producer(BoundedBuffer buf, int lastElement, int lastItem)
        {
            LastElement = lastElement;
            LastItem = lastItem;
            Buffer = buf;

        }
예제 #2
0
        static void Main(string[] args)
        {
            BoundedBuffer buf = new BoundedBuffer(4);

            Producer prod = new Producer(buf, 10);
            Consumer cons = new Consumer(buf);

            Parallel.Invoke(prod.Run, cons.Run);
        }
예제 #3
0
        static void Main(string[] args)
        {
            BoundedBuffer buf = new BoundedBuffer(4);

            Producer prod = new Producer(buf, 10);
            Consumer cons = new Consumer(buf);

            Parallel.Invoke(prod.Run, cons.Run);

        }
예제 #4
0
        static void Main(string[] args)
        {
            BoundedBuffer buf = new BoundedBuffer(4);

            Producer prod  = new Producer(buf, 10);
            Consumer cons1 = new Consumer(buf);
            Consumer cons2 = new Consumer(buf);

            Parallel.Invoke(prod.Run, cons1.Run, cons2.Run);

            Console.WriteLine("Done!");
            Console.ReadKey();
        }
예제 #5
0
 public Producer(BoundedBuffer buf, int howMany)
 {
     Max    = howMany;
     Buffer = buf;
 }
예제 #6
0
 public Consumer(BoundedBuffer buf)
 {
     Buffer = buf;
 }
예제 #7
0
 public Producer(BoundedBuffer buf, int lastElement, int lastItem)
 {
     LastElement = lastElement;
     LastItem    = lastItem;
     Buffer      = buf;
 }
예제 #8
0
        public Consumer(BoundedBuffer buf)
        {
            Buffer = buf;

        }