示例#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;

        }