Commit 8ad9e74f authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺 Committed by Ben Gamari

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
parent b3d6c0f7
......@@ -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");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment