New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of usleep in conflict with SUSv2 (fencepost error) #714
Comments
Bah, the diff didn't format all that well, let's try to do it better:
|
This patch no longer applies to 4.0.0 but I made it work and currently testing this. Nicely done! 🤘 Just to be clear, where you seeing timer test failures or were you seeing the Timer PMC tests intermittently hang forever? |
Sadly, I am still seeing t/pmc/timer.t hang forever after test 11. That being said, it could be that my hanging issue is totally different than this fencepost error. Not quite sure yet. |
I made a branch for this patch: https://github.com/parrot/parrot/tree/714/scheduler_bug Can we get some testing on various platforms? |
Yah, I saw that construct had gone in 3.10.0. I'm seeing New and
I was seeing test failures, as in: Test Summary Reportt/op/time.t (Wstat: 0 Tests: 19 Failed: 2) E.g. one of the tests did "sleep 1", which instead of doing sleep(1) Regards,
|
SUSv2 says in http://pubs.opengroup.org/onlinepubs/7908799/xsh/usleep.html:
The useconds argument must be less than 1,000,000.
The NetBSD libc implementation enforces this limitation.
However, parrot will try to use that exact value, due to a fencepost error,
and this causes several of the timer tests to fail.
Fix for parrot 3.9.0:
--- src/scheduler.c.orig 2011-10-18 22:44:11.000000000 +0000
+++ src/scheduler.c
@@ -993,7 +993,7 @@ Parrot_cx_schedule_sleep(PARROT_INTERP,
Parrot_cx_runloop_wake(interp, interp->scheduler);
/* prevent integer overflow when converting to microseconds
* and problems in platforms that doesn't allow usleep more
* than 1 second */
The text was updated successfully, but these errors were encountered: