Re: usleep: Document Cygwin bug

2024-06-08 Thread Bruno Haible
Cygwin. 2024-06-08 Bruno Haible usleep tests: Avoid failure due to known Cygwin 3.5.3 bug. * modules/usleep-tests (Depends-on): Add test-xfail. (Makefile.am): Don't test test-usleep on Cygwin. diff --git a/modules/usleep-tests b/modules/usleep-tests index 531c685eb5..f77e

usleep: Document Cygwin bug

2024-06-07 Thread Bruno Haible
In a CI run of libunistring (on GitHub), I see a test failure: ../../tests/test-usleep.c:35: assertion 'start < time (NULL)' failed FAIL test-usleep.exe (exit status: 134) This is the failing code: time_t start = time (NULL); ASSERT (usleep (100) == 0); ASSERT (start

usleep: implement with millisecond resolution on native Windows

2019-07-02 Thread Bruno Haible
The usleep() emulation on MSVC has a resolution of 1 second only. This patch improves it, to have a resolution of 15 milliseconds. 2019-07-02 Bruno Haible usleep: Implement with millisecond resolution on native Windows. * lib/usleep.c (usleep): On native Windows, implement

Re: Poor granularity of usleep impl on Win32

2014-04-24 Thread Daniel P. Berrange
On Wed, Apr 23, 2014 at 08:38:07PM -0600, Eric Blake wrote: > On 04/23/2014 04:26 AM, Daniel P. Berrange wrote: > > The gnulib usleep replacement says > > > > /* This file is _intentionally_ light-weight. Rather than using > > select or nanosleep, both of which

Re: Poor granularity of usleep impl on Win32

2014-04-23 Thread Eric Blake
On 04/23/2014 04:26 AM, Daniel P. Berrange wrote: > The gnulib usleep replacement says > > /* This file is _intentionally_ light-weight. Rather than using > select or nanosleep, both of which drag in external libraries on > some platforms, this merely rounds up to the

Re: Poor granularity of usleep impl on Win32

2014-04-23 Thread Eric Blake
On 04/23/2014 04:26 AM, Daniel P. Berrange wrote: > The gnulib usleep replacement says > > /* This file is _intentionally_ light-weight. Rather than using > select or nanosleep, both of which drag in external libraries on > some platforms, this merely rounds up to the

Poor granularity of usleep impl on Win32

2014-04-23 Thread Daniel P. Berrange
The gnulib usleep replacement says /* This file is _intentionally_ light-weight. Rather than using select or nanosleep, both of which drag in external libraries on some platforms, this merely rounds up to the nearest second if usleep() does not exist. If sub-second resolution

Re: usleep

2009-11-20 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 11/18/2009 10:16 PM: > At any rate, here's what I'm now testing, it has passed on cygwin, 64-bit > Linux, and Solaris. The nanosleep code is a complete rewrite, and is > actually lighter-weight (no need to use clock_gettime)

Re: usleep

2009-11-18 Thread Eric Blake
(limit); + if (result) +return seconds + result; +} + return sleep (seconds); +} + +#else /* !HAVE_SLEEP */ #error "Please port gnulib sleep.c to your platform, possibly using usleep() or select(), then report this to bug-gnulib." diff --git a/lib/unistd.in.h b/lib/un

Re: usleep

2009-11-18 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Ludovic Courtès on 11/18/2009 4:35 PM: >> +{ >> + seconds -= limit; >> + unsigned int result = sleep (limit); > > This declaration-after-statement is a C99 thing. Isn’t it something > usually avoided in Gnulib? Yep. I'll

Re: usleep

2009-11-18 Thread Ludovic Courtès
Hi, Eric Blake writes: > +unsigned int > +rpl_sleep (unsigned int seconds) > +{ > + const unsigned int limit = 49 * 24 * 60 * 60; > + while (limit < seconds) > +{ > + seconds -= limit; > + unsigned int result = sleep (limit); This declaration-after-statement is a C99 thing. Isn

Re: usleep (was: pending patches?)

2009-11-18 Thread Eric Blake
Eric Blake byu.net> writes: > I'm pushing this. Most systems these days still support usleep, even > though POSIX no longer requires it; even mingw has it; so the few > platforms where this implementation rounds up to the ceiling of the next > second should be rare (still co

usleep (was: pending patches?)

2009-11-17 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 11/14/2009 6:18 AM: > I'm also thinking of adding a usleep module to guarantee Linux semantics > (usleep(100) waits a second, rather than failing instantly with > EINVAL). That will clean up its use