Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007257OCamlruntime system and C interfacepublic2016-05-14 13:072017-09-24 17:32
Assigned Togasche 
Platformamd64OSFreeBSDOS Version
Product Version4.03.0 
Target VersionFixed in Version4.04.0 +dev / +beta1 / +beta2 
Summary0007257: regressions in sleep (Unix.sleep 0)
DescriptionIn 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 [^] if your code uses a specific POSIX version, you should "#define _POSIX_C_SOURCE <ver>", 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 InformationIt 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.
TagsNo tags attached.
Attached Files

- Relationships
related to 0004023closed usleep feature 

-  Notes
gasche (administrator)
2016-05-14 14:48

Related links are hannes' pull request: [^]
and the previous PR implementing sleepf: [^]
gasche (administrator)
2016-06-21 16:40

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

- Issue History
Date Modified Username Field Change
2016-05-14 13:07 hannes New Issue
2016-05-14 14:48 gasche Note Added: 0015930
2016-05-14 14:48 gasche Relationship added related to 0004023
2016-06-15 19:07 gasche Status new => confirmed
2016-06-21 16:40 gasche Note Added: 0015991
2016-06-21 16:40 gasche Status confirmed => resolved
2016-06-21 16:40 gasche Fixed in Version => 4.04.0 +dev / +beta1 / +beta2
2016-06-21 16:40 gasche Resolution open => fixed
2016-06-21 16:40 gasche Assigned To => gasche
2017-02-23 16:43 doligez Category OCaml runtime system => runtime system
2017-03-03 17:45 doligez Category runtime system => runtime system and C interface
2017-09-24 17:32 xleroy Status resolved => closed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker