You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've done a bit more investigation here and found two more things:
Lock promotion doesn't work - i.e. Unix.(lockf fd F_RLOCK 0; lockf fd F_LOCK 0) will block
Blocking out other file handles within the same thread/process is the intended behaviour of the LockFile Windows API call
I can see how the Unix module could work around problem 1 (it's just yet another instance of needing to add information to the fd structure!), but I can't see an easy way to work around the other problem without having to track all open file descriptors and re-map them.
Clearly, POSIX and Win32 give different semantics to file locks. I think it is hopeless to commit on one semantics and emulate it on the other OS (or one both): this sounds technically very difficult, and moreover it's not obvious to me which semantics is the right one! My proposal is just to document the differences in behavior.
Original bug ID: 7264
Reporter: @dra27
Status: resolved (set by @xavierleroy on 2017-02-16T08:39:02Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.02.2
Target version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Category: platform support (windows, cross-compilation, etc)
Monitored by: @dbuenzli
Bug description
Unix.lockf on Windows seems to lock out file handles on the same file for the current process as well.
Steps to reproduce
In a toploop with unix.cma loaded:
The text was updated successfully, but these errors were encountered: