public Producer(BoundedBuffer buf, int lastElement, int lastItem) { LastElement = lastElement; LastItem = lastItem; Buffer = buf; }
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); }
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(); }
public Producer(BoundedBuffer buf, int howMany) { Max = howMany; Buffer = buf; }
public Consumer(BoundedBuffer buf) { Buffer = buf; }