[commit: ghc] master: Make `timer_create(CLOCK_REALTIME)` autoconf test more reliable (8ad9e74)
git at git.haskell.org
git at git.haskell.org
Tue Nov 17 15:20:06 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/8ad9e74f1f88d5c86d2e76f9992f9b2d267421d3/ghc
>---------------------------------------------------------------
commit 8ad9e74f1f88d5c86d2e76f9992f9b2d267421d3
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Tue Nov 17 15:30:56 2015 +0100
Make `timer_create(CLOCK_REALTIME)` autoconf test more reliable
I've noticed that on a platform with a coarse timer/scheduling
granularity of 10ms this autoconf tests fails to detect a working
`timer_create(CLOCK_REALTIME)`.
On AIX, this effectively means that intervals/timers are rounded up to
multiples of 10ms, so a 13ms delay is effectively a 20ms delay.
By using a 100ms timeout we are on the safe side.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie, erikd
Differential Revision: https://phabricator.haskell.org/D1483
>---------------------------------------------------------------
8ad9e74f1f88d5c86d2e76f9992f9b2d267421d3
aclocal.m4 | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 2bf27be..33f05e5 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1591,17 +1591,18 @@ int main(int argc, char *argv[])
exit(2);
}
+ tock = 0;
+
it.it_value.tv_sec = 0;
- it.it_value.tv_nsec = 1000000;
+ it.it_value.tv_nsec = 1000000; // 1ms
it.it_interval = it.it_value;
if (timer_settime(timer, 0, &it, NULL) != 0) {
fprintf(stderr,"settime problem\n");
exit(4);
}
- tock = 0;
-
- usleep(3000);
+ // some environments have coarse scheduler/timer granularity of ~10ms and worse
+ usleep(100000); // 100ms
if (!tock) {
fprintf(stderr,"no CLOCK_REALTIME signal\n");
More information about the ghc-commits
mailing list