示例#1
0
文件: Async.cs 项目: ExM/AsyncToolkit
 public static void Sleep(SleepSticker ss, int timeout, Action<bool> action)
 {
     RegisteredWaitHandle handle = null;
     handle = ThreadPool.RegisterWaitForSingleObject(ss.Wait, (object state, bool timedOut) =>
     {
         handle.Unregister(ss.Wait);
         action(timedOut);
     }, null, timeout, true);
 }
示例#2
0
        public static void Sleep(SleepSticker ss, int timeout, Action <bool> action)
        {
            RegisteredWaitHandle handle = null;

            handle = ThreadPool.RegisterWaitForSingleObject(ss.Wait, (object state, bool timedOut) =>
            {
                handle.Unregister(ss.Wait);
                action(timedOut);
            }, null, timeout, true);
        }