First commit
[clinton/Virtual-Jaguar-Rx.git] / src / _MSC_VER / usleep.cpp
1 // http://stackoverflow.com/questions/5801813/c-usleep-is-obsolete-workarounds-for-windows-mingw
2
3 #include <windows.h>
4
5 void usleep(__int64 usec)
6 {
7 HANDLE timer;
8 LARGE_INTEGER ft;
9
10 ft.QuadPart = -(10*usec); // Convert to 100 nanosecond interval, negative value indicates relative time
11
12 timer = CreateWaitableTimer(NULL, TRUE, NULL);
13 SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
14 WaitForSingleObject(timer, INFINITE);
15 CloseHandle(timer);
16 }