annotate modules/sleep @ 17388:3c592b4deb04

utimensat-tests, etc.: try to fix some races Problem reported by Bernhard Voelker in <http://lists.gnu.org/archive/html/bug-gnulib/2013-04/msg00071.html>. I don't know whether this patch fixes that race condition, but it fixes *some* race conditions, so it should be a win. * modules/chown-tests (Depends-on): * modules/fchownat-tests (Depends-on): * modules/fdutimensat-tests (Depends-on): * modules/futimens-tests (Depends-on): * modules/lchown-tests (Depends-on): * modules/stat-time-tests (Depends-on): * modules/utimens-tests (Depends-on): * modules/utimensat-tests (Depends-on): Depend on nanosleep, not usleep. * modules/chown-tests (test_chown_LDADD): * modules/lchown-tests (test_lchown_LDADD): * modules/stat-time-tests (test_stat_time_LDADD): New macro. * modules/fchownat-tests (test_fchownat_LDADD): * modules/fdutimensat-tests (test_fdutimensat_LDADD): * modules/futimens-tests (test_futimens_LDADD): * modules/utimens-tests (test_utimens_LDADD): * modules/utimensat-tests (test_utimensat_LDADD): Add $(LIB_NANOSLEEP). * modules/stat-time-tests (Files): Add tests/nap.h. * tests/nap.h: Include <limits.h>, for INT_MAX. (lt_mtime): Remove. (diff_timespec): New function. (get_stat): Rename from get_mtime. All callers changed. (nap_works): Determine the needed delay by inspecting the file system's timestamp jumps; this should be more reliable. Look at both mtime and ctime, and take the maximum of the two jumps. (nap_works, guess_delay): Return a nanosecond cound, not a microsecond count. All callers changed. (nap_works, nap): Use nanosleep, not usleep. Check for nanosleep failure. (nap): Multiply the guess by 1.125, to accommodate the case where the file system's clock is a bit slower than nanosleep's clock. * tests/test-stat-time.c (BASE): New macro. Include nap.h. (nap): Remove; nap.h now defines this. This removes a duplicate implementation of 'nap'.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 30 Apr 2013 23:14:19 -0700
parents a81da81ea7f2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8786
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 Description:
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 sleep() function: pause execution of the current thread.
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 Files:
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 lib/sleep.c
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 m4/sleep.m4
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 Depends-on:
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 unistd
14683
efab6978105e Avoid unnecessary compilation units, through conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 12326
diff changeset
10 stdint [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1]
efab6978105e Avoid unnecessary compilation units, through conditional dependencies.
Bruno Haible <bruno@clisp.org>
parents: 12326
diff changeset
11 verify [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1]
8786
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 configure.ac:
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 gl_FUNC_SLEEP
15096
a81da81ea7f2 sleep: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14683
diff changeset
15 if test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1; then
a81da81ea7f2 sleep: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14683
diff changeset
16 AC_LIBOBJ([sleep])
a81da81ea7f2 sleep: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14683
diff changeset
17 fi
8786
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 gl_UNISTD_MODULE_INDICATOR([sleep])
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 Makefile.am:
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 Include:
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 <unistd.h>
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 License:
10576
27a1858c4c79 Relax license to LGPLv2+.
Bruno Haible <bruno@clisp.org>
parents: 8786
diff changeset
26 LGPLv2+
8786
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 Maintainer:
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 Bruno Haible
b7c6961fb530 New module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30