public class MreTest1 { public static ManualResetEvent mre = new ManualResetEvent(false); public static void Add() { while (true) { Thread.Sleep(1000); Console.WriteLine(Thread.CurrentThread.Name + " 生产者"); MreTest2.mre.Set(); mre.Reset(); mre.WaitOne(); } } } public class MreTest2 { public static ManualResetEvent mre = new ManualResetEvent(false); public static void Del() { mre.WaitOne(); while (true) { Thread.Sleep(2000); Console.WriteLine(Thread.CurrentThread.Name + " 消费者"); MreTest1.mre.Set(); mre.Reset(); mre.WaitOne(); } } }