http://www.cnblogs.com/Kazaf/archive/2012/03/26/2417341.html具体看这位写的即可
RegisterWaitForSingleObject的最后一个参数bool 如果是false就是循环 如果是true则只进一次
如果要跳出该循环则
static AutoResetEvent wait = new AutoResetEvent(false);
static void Main(string[] args)
{
object state = new object();
var reg = ThreadPool.RegisterWaitForSingleObject(wait, new WaitOrTimerCallback(test11), state, 1000, false);
Console.ReadKey();
//按回车即可跳出循环
reg.Unregister(wait);
Console.ReadKey();
}
private static void test11(object state, bool timedOut)
{
Console.WriteLine("aaa");
}