static void Main(string[] args) { Stopwatch s1 = new Stopwatch(); s1.Start(); Boundedbuffer buf = new Boundedbuffer(4); Producer prod = new Producer(buf, 100); Consumer con = new Consumer(); Parallel.Invoke(prod.run, con.Run); s1.Stop(); Console.WriteLine("tid" + s1.Elapsed); Console.ReadKey(); }
static void Main(string[] args) { Stopwatch s1 = new Stopwatch(); s1.Start(); Boundedbuffer buf = new Boundedbuffer(10); Producer prod = new Producer(buf, 100); Consumer con = new Consumer(buf, 100); Parallel.Invoke(prod.run, con.Run); s1.Stop(); Console.WriteLine("tid" + s1.Elapsed); Console.ReadKey(); }
public Producer(Boundedbuffer buffer, int howManyToProduce) { this._max = howManyToProduce; this._buffer = buffer; }
public Consumer(Boundedbuffer buffer, int expectedAmount) { this._buffer = buffer; this._max = expectedAmount; }
public Consumer(Boundedbuffer buffer, int expectedAmount) { this._buffer = buffer; this._max = expectedAmount; }
public Producer(Boundedbuffer buffer, int howManyToProduce) { this._max = howManyToProduce; this._buffer = buffer; }