Skip to content
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

regressions in sleep (Unix.sleep 0) #7257

Closed
vicuna opened this issue May 14, 2016 · 2 comments
Closed

regressions in sleep (Unix.sleep 0) #7257

vicuna opened this issue May 14, 2016 · 2 comments
Assignees
Labels

Comments

@vicuna
Copy link

@vicuna vicuna commented May 14, 2016

Original bug ID: 7257
Reporter: @hannesm
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-09-24T15:32:59Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: amd64
OS: FreeBSD
Version: 4.03.0
Fixed in version: 4.04.0 +dev / +beta1 / +beta2
Category: runtime system and C interface
Related to: #4023

Bug description

In OCaml < 4.03, a Unix.sleep 0 executed the syscall sleep (or nanosleep) with 0 seconds.

I use this mechanism to signal to DTrace the begin and finish of a test.

In 4.03, Unix.sleep 0 does not lead to a syscall anymore, it returns immediately.

Another regression is that sleep used to use nanosleep, but now it uses select (on this machine here), because of an unusual usage of _POSIX_C_SOURCE -- as far as I understand from http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_02.html if your code uses a specific POSIX version, you should "#define _POSIX_C_SOURCE ", whereas sleep.c does a "#ifdef _POSIX_C_SOURCE >= 199309L". FreeBSD provides "nanosleep" as part of libc.

My impression is that instead of _POSIX_C_SOURCE, a check in configure should be used which tests whether nanosleep is available on the system.

Additional information

It would be great to get back support for Unix.sleep 0. Also, using nanosleep again, instead of select would be great. I can prepare a GPR if you agree that both are regressions.

@vicuna
Copy link
Author

@vicuna vicuna commented May 14, 2016

Comment author: @gasche

Related links are hannes' pull request:
#583
and the previous PR implementing sleepf:
#68

@vicuna
Copy link
Author

@vicuna vicuna commented Jun 21, 2016

Comment author: @gasche

Fixed in trunk by hannes' pull request. The fix will be in 4.04.

@vicuna vicuna closed this Sep 24, 2017
@vicuna vicuna added the stdlib label Mar 14, 2019
@vicuna vicuna mentioned this issue Sep 24, 2017
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.