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); }
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); }