windows: Provide a cancellable usleep(), but with ms resolution only
This commit is contained in:
@@ -36,6 +36,19 @@ void windows_deinit()
|
|||||||
WSACleanup();
|
WSACleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See header
|
||||||
|
*/
|
||||||
|
int usleep(useconds_t usec)
|
||||||
|
{
|
||||||
|
if (usec > 0 && usec < 1000)
|
||||||
|
{ /* do not Sleep(0) for small values */
|
||||||
|
usec = 1000;
|
||||||
|
}
|
||||||
|
SleepEx(usec / 1000, TRUE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See header
|
* See header
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ static inline int sleep(unsigned int seconds)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replacement of usleep(3), cancellable, ms resolution only
|
||||||
|
*/
|
||||||
|
int usleep(useconds_t usec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* strdup(3), the Windows variant can't free(strdup("")) and others
|
* strdup(3), the Windows variant can't free(strdup("")) and others
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user