Пример #1
0
 public static void test_eventhandler()
 {
     ProducerAndConsumer pac = new ProducerAndConsumer();
     System.Threading.Thread producer = new System.Threading.Thread(new System.Threading.ThreadStart(pac.method_producer));
     producer.Start();
     for (int i = 0; i < 3; i++)
     {
         System.Threading.Thread consumer = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(pac.method_comsumer));
         consumer.Start(i);
     }
 }
Пример #2
0
        public static void test_eventhandler()
        {
            ProducerAndConsumer pac = new ProducerAndConsumer();

            System.Threading.Thread producer = new System.Threading.Thread(new System.Threading.ThreadStart(pac.method_producer));
            producer.Start();
            for (int i = 0; i < 3; i++)
            {
                System.Threading.Thread consumer = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(pac.method_comsumer));
                consumer.Start(i);
            }
        }
Пример #3
0
 public static void test()
 {
     ProducerAndConsumer pac = new ProducerAndConsumer();
     System.Threading.Thread producer = new System.Threading.Thread(new System.Threading.ThreadStart(pac.produce));
     System.Threading.Thread consumer = new System.Threading.Thread(new System.Threading.ThreadStart(pac.consumer));
     producer.Start();
     consumer.Start();
     System.Threading.Thread producer1 = new System.Threading.Thread(new System.Threading.ThreadStart(pac.produce));
     System.Threading.Thread consumer1 = new System.Threading.Thread(new System.Threading.ThreadStart(pac.consumer));
     producer1.Start();
     consumer1.Start();
     System.Threading.Thread producer2 = new System.Threading.Thread(new System.Threading.ThreadStart(pac.produce));
     System.Threading.Thread consumer2 = new System.Threading.Thread(new System.Threading.ThreadStart(pac.consumer));
     producer2.Start();
     consumer2.Start();
 }
Пример #4
0
        public static void test()
        {
            ProducerAndConsumer pac = new ProducerAndConsumer();

            System.Threading.Thread producer = new System.Threading.Thread(new System.Threading.ThreadStart(pac.produce));
            System.Threading.Thread consumer = new System.Threading.Thread(new System.Threading.ThreadStart(pac.consumer));
            producer.Start();
            consumer.Start();
            System.Threading.Thread producer1 = new System.Threading.Thread(new System.Threading.ThreadStart(pac.produce));
            System.Threading.Thread consumer1 = new System.Threading.Thread(new System.Threading.ThreadStart(pac.consumer));
            producer1.Start();
            consumer1.Start();
            System.Threading.Thread producer2 = new System.Threading.Thread(new System.Threading.ThreadStart(pac.produce));
            System.Threading.Thread consumer2 = new System.Threading.Thread(new System.Threading.ThreadStart(pac.consumer));
            producer2.Start();
            consumer2.Start();
        }