Proper check and dropin replacement for usleep().

This commit is contained in:
Guus Sliepen 2011-01-12 20:57:14 +01:00
parent 4b8a599303
commit b3731c0409
3 changed files with 5 additions and 4 deletions

View file

@ -164,9 +164,10 @@ int gettimeofday(struct timeval *tv, void *tz) {
}
#endif
#ifdef HAVE_MINGW
#ifndef HAVE_USLEEP
int usleep(long usec) {
Sleep(usec / 1000);
struct timeval tv = {usec / 1000000, (usec / 1000) % 1000};
select(0, NULL, NULL, NULL, &tv);
return 0;
}
#endif

View file

@ -41,7 +41,7 @@ extern int vasprintf(char **, const char *, va_list ap);
extern int gettimeofday(struct timeval *, void *);
#endif
#ifdef HAVE_MINGW
#ifndef HAVE_USLEEP
extern int usleep(long);
#endif