Пример #1
0
        private async static Task MainObservable(string[] args)
        {
            BlockingProducer producer = new BlockingProducer(5, 10);
            BlockingConsumer consumer = new BlockingConsumer(10);

            ObservingDataController controller = new ObservingDataController(producer, consumer);
            await controller.StartReceivingData();
        }
Пример #2
0
        private static async Task MainAsync(string[] args)
        {
            BlockingProducer producer = new BlockingProducer(10, 10);
            BlockingConsumer consumer = new BlockingConsumer(10);

            ConcurrentQueue <string> buffer = new ConcurrentQueue <string>(); //unbounded buffer

            QueueingDataController controller = new QueueingDataController(producer, consumer, buffer);

            await controller.StartReceivingData(); //n.b. one of these tasks appears to starve the other if prod/cons too unbalanced
        }