[commit: ghc] wip/ghc710-aix: Make `timer_create(CLOCK_REALTIME)` autoconf test more reliable (3d5270d)
git at git.haskell.org
git at git.haskell.org
Tue Nov 17 22:29:12 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/ghc710-aix
Link : http://ghc.haskell.org/trac/ghc/changeset/3d5270d75ceef8ed0c82e077ad10d5d21247f03c/ghc
>---------------------------------------------------------------
commit 3d5270d75ceef8ed0c82e077ad10d5d21247f03c
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
(cherry picked from commit 8ad9e74f1f88d5c86d2e76f9992f9b2d267421d3)
>---------------------------------------------------------------
3d5270d75ceef8ed0c82e077ad10d5d21247f03c
aclocal.m4 | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 8732e0e..67692e3 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1772,17 +1772,18 @@ out:
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