Beispiel #1
0
        public static void MicroSleep(Int64 MicroSec)
        {
            IntPtr timer;

            LARGE_INTEGER ft = new LARGE_INTEGER();

            ft.QuadPart = -(10 * MicroSec);

            timer = CreateWaitableTimer(IntPtr.Zero, true, null);
            SetWaitableTimer(timer, ref ft, 0, null, IntPtr.Zero, false);
            WaitForSingleObject(timer, 0xFFFFFFFF);
            CloseHandle(timer);
        }
Beispiel #2
0
 public static extern bool SetWaitableTimer(IntPtr hTimer, [In] ref LARGE_INTEGER ft, int lPeriod, TimerCompleteDelegate pfnCompletionRoutine, IntPtr pArgToCompletionRoutine, bool fResume);