Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public static extern bool SetWaitableTimer(IntPtr hTimer, [In] ref LARGE_INTEGER ft, int lPeriod, TimerCompleteDelegate pfnCompletionRoutine, IntPtr pArgToCompletionRoutine, bool fResume);