[svn] Don't sleep using usleep for more than a second.

This commit is contained in:
hniksic 2004-01-24 19:16:33 -08:00
parent 6be0e99a5e
commit dc99d9a487
2 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2004-01-25 Hrvoje Niksic <hniksic@xemacs.org>
* utils.c (xsleep): Don't call usleep with values larger than
1,000,000.
2003-12-16 Hrvoje Niksic <hniksic@xemacs.org>
* http.c (gethttp): Fix generation of `Content-Length'.

View File

@ -1954,11 +1954,10 @@ xsleep (double seconds)
#else /* not HAVE_NANOSLEEP */
#ifdef HAVE_USLEEP
/* If usleep is available, use it in preference to select. */
if (seconds > 1000)
if (seconds >= 1)
{
/* usleep apparently accepts unsigned long, which means it can't
sleep longer than ~70 min (35min if signed). If the period
is larger than what usleep can safely handle, use sleep
/* On some systems, usleep cannot handle values larger than
1,000,000. If the period is larger than that, use sleep
first, then add usleep for subsecond accuracy. */
sleep (seconds);
seconds -= (long) seconds;