| 1 |
#ifndef lint |
| 2 |
static const char RCSid[] = "$Id$"; |
| 3 |
#endif |
| 4 |
/* |
| 5 |
* Windows replacement usleep() function. |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "platform.h" |
| 9 |
|
| 10 |
int |
| 11 |
usleep(__int64 usec) |
| 12 |
{ |
| 13 |
HANDLE timer; |
| 14 |
LARGE_INTEGER ft; |
| 15 |
|
| 16 |
// Convert to 100 nanosecond interval, negative value indicates relative time |
| 17 |
ft.QuadPart = -(10*usec); |
| 18 |
|
| 19 |
timer = CreateWaitableTimer(NULL, TRUE, NULL); |
| 20 |
SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); |
| 21 |
WaitForSingleObject(timer, INFINITE); |
| 22 |
CloseHandle(timer); |
| 23 |
return(0); |
| 24 |
} |