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); } }
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(); }