The current implementation of nanosleep is broken on mingw for several reasons:
1) It requires linking with -lws2_32, as evidenced by these error messages:
gcc-3 -mno-cygwin -g -O2 -L/usr/local/mingw/lib -o test-nanosleep.exe
test-nanosleep.o ../gllib/libgnu.a
Bruno Haible wrote:
...
So here is a proposed patch for implementing a Woe32 nanosleep with a
resolution of ca. 10 microseconds or higher.
2010-04-04 Bruno Haible br...@clisp.org
Implement nanosleep for native Windows.
* lib/nanosleep.c (nanosleep): New implementation for
Jim Meyering wrote:
You're welcome to commit that.
Committed. The only thing I'm worried about is that it's a compromise
between precision of the time interval and ues of CPU time:
Someone who invokes nanosleep with an argument of 0.3 seconds may complain
that 9.4 ms of busy-looping is not
Bruno Haible wrote:
Similarly, on mingw with warn-on-use.h modified to work like if g++ = 4.3
were present, I'm seeing this error:
../gllib/time.h:359: error: `nanosleep' was not declared in this scope
It would also be an error on the other platforms lacking nanosleep,
with g++ 4.3.
Hi Jim,
Though note that the patches to modules/time and m4/time_h.m4
did not apply and I did them manually.
Yes, I was constantly changing the same parts of these two files.
Please apply.
Applied.
Bruno