support even older versions of mingw (as found on some Debian distros) that lack usleep/nanosleep, but have _sleep

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1828 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Mike Frysinger 15 years ago
parent 95158bc90a
commit 9299ad8c3f

@ -1,3 +1,9 @@
2010-08-18 Mike Frysinger <vapier@gentoo.org>
* configure.ac (AC_CHECK_FUNCS): Check for _sleep.
* src/lib/usleep.c: Support a fuzzy version of usleep based on old mingw
_sleep functions.
2010-08-16 Mike Frysinger <vapier@gentoo.org>
* src/tap/detect.c (urj_tap_detect_parts): Include paths to data files when

@ -116,6 +116,7 @@ else
fi
AC_CHECK_FUNCS(m4_flatten([
_sleep
geteuid
getuid
nanosleep

@ -23,9 +23,7 @@
#ifndef HAVE_USLEEP
#ifndef HAVE_NANOSLEEP
# error Need usleep or nanosleep
#endif
#ifdef HAVE_NANOSLEEP
#include <time.h>
@ -42,4 +40,17 @@ int usleep (long unsigned usec)
return nanosleep (&req, NULL);
}
#elif defined(HAVE__SLEEP)
/* Not exact, but close enough */
int usleep (long unsigned usec)
{
_sleep (usec / 1000);
return 0;
}
#else
# error "Need sleep, usleep, or nanosleep"
#endif
#endif

Loading…
Cancel
Save