using System;
using System.Threading;
public class MainClass
{
public static AutoResetEvent A = new AutoResetEvent(false);
public static int index = 0;
public static int Main(){
Timer T = new Timer(new TimerCallback(TimerHandler), null, 5000, 10000);
A.WaitOne();
Console.WriteLine("Main Thread event signaled");
T.Dispose();
return 0;
}
public static void TimerHandler(object state)
{
Console.WriteLine("TimerHandler");
if (index == 5)
A.Set();
index++;
Console.WriteLine(index);
}
}
|