private static void BlockingCollectionBufferRun() { Logger.Info("Program started; 1 producer, 2 consumers"); BlockingCollectionBuffer buffer = new BlockingCollectionBuffer(25); Producer producer = new Producer(buffer, 10); Consumer consumer = new Consumer(buffer); Consumer consumer2 = new Consumer(buffer); Task.Factory.StartNew(producer.Run); Task.Factory.StartNew(consumer.Run); Task.Factory.StartNew(consumer2.Run); //thread1.Start(); //thread2.Start(); //thread3.Start(); //thread1.Join(); //thread2.Join(); //thread3.Join(); Console.ReadLine(); Logger.Info("Program ended"); }
public FilterWorker(BlockingCollectionBuffer inbuffer, BlockingCollectionBuffer outbuffer) { this.inbuffer = inbuffer; this.outbuffer = outbuffer; }
public Producer(BlockingCollectionBuffer buffer, int howMany) { this.howMany = howMany; this.buffer = buffer; }
public Consumer(BlockingCollectionBuffer buffer) { //this.howMany = howMany; this.buffer = buffer; }