using System;
using System.Threading;
class MyMainClass
{
    static AutoResetEvent myResetEvent = new AutoResetEvent(false);
    static int number;
    static void Main()
    {
        Thread myReaderThread = new Thread(new ThreadStart(MyReadThreadProc));
        myReaderThread.Name = "߳";
        myReaderThread.Start();
        for (int i = 1; i <= 100; i++)
        {
            Console.WriteLine("д߳дֵ: {0}", i);
            number = i;//һźŸд߳
            myResetEvent.Set();
            Thread.Sleep(1);
        }
        myReaderThread.Abort();
    }
    static void MyReadThreadProc()
    {
        while (true)
        {
            myResetEvent.WaitOne(); 
            Console.WriteLine("{0} ֵ: {1}", Thread.CurrentThread.Name, number);
        }
    }
}
