static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();

            Context ctx = new Context();
            //using(ConsumerWorkerController<Book> conumsers = new ConsumerWorkerController<Book>(
            using (ConsumerWorkerController<Book> ctrl = new ConsumerWorkerController<Book>(3, 2, ctx))
            {
                //ctrl.InitializeWorkers<Book>();
                ctrl.CreateConsumerWorker += new ConsumerWorkerController<Book>.CreateConsumerWorkerEvent(ctrl_CreateWorker);

                ctrl.CreateProducerWorker += new ConsumerWorkerController<Book>.CreateProducerWorkerEvent(ctrl_CreateProducerWorker);
                ctrl.Initialize();

                //for (int i = 0; i < 5; i++)
                //{
                //    ctrl.Workers[i] = new TestConsumer1(i.ToString(), ctrl);
                //}
                //TaskQueue<Book> queue = new TaskQueue<Book>();
                //ctrl.que
                //for (int i = 0; i < 10; i++)
                //{
                //    Book b = new Book(i);
                //    Thread.Sleep(250);
                //    ctrl.PushProduct(b);
                //    //b.Consume();
                //}
            }

            //using (TaskQueue<Book> queue = new TaskQueue<Book>(5))
            //{
            //    for (int i = 0; i < 10; i++)
            //    {
            //        Book b = new Book(i);
            //        //Thread.Sleep(2500);
            //        queue.EnqueueTask(b);
            //        //b.Consume();
            //    }
            //}

            sw.Stop();
            Console.WriteLine("Last Seconds: " + sw.Elapsed.TotalSeconds);
            Console.Read();
        }
        static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();

            // When consumer count is larger than producer count.
            // Currnet implementation is not working, coz there is only one EndProd is produced
            // So there is only one consumer get thie EndProd and stopped, the other two are still waiting......
            using (ConsumerWorkerController<Book> ctrl = new ConsumerWorkerController<Book>(5, 2))
            {
                ctrl.CreateConsumer += new ConsumerWorkerController<Book>.CreateConsumerEvent(ctrl_CreateWorker);
                ctrl.CreateProducer += new ConsumerWorkerController<Book>.CreateProducerEvent(ctrl_CreateProducer);
                ctrl.Initialize();
            }

            sw.Stop();
            Console.WriteLine("Last Seconds: " + sw.Elapsed.Seconds);
            Console.Read();
        }
 static ConsumerWorker<Book> ctrl_CreateWorker(ConsumerWorkerController<Book> workerController, string workerName)
 {
     return new TestConsumer1(workerName, workerController);
 }
 static ProducerWorker<Book> ctrl_CreateProducer(ConsumerWorkerController<Book> workerController, string producerName)
 {
     return new TestProducer1(producerName, workerController);
 }
 static ConsumerWorker<Book> ctrl_CreateWorker(ConsumerWorkerController<Book> workerController, string workerName, Context ctx)
 {
     return new TestConsumer1(workerName, workerController, ctx, System.Globalization.CultureInfo.CurrentCulture);
 }