예제 #1
0
        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");
        }
예제 #2
0
 public FilterWorker(BlockingCollectionBuffer inbuffer, BlockingCollectionBuffer outbuffer)
 {
     this.inbuffer = inbuffer;
     this.outbuffer = outbuffer;
 }
예제 #3
0
 public Producer(BlockingCollectionBuffer buffer, int howMany)
 {
     this.howMany = howMany;
     this.buffer = buffer;
 }
예제 #4
0
 public Consumer(BlockingCollectionBuffer buffer)
 {
     //this.howMany = howMany;
     this.buffer = buffer;
 }