Bulat Ziganshin wrote:
> Hello Simon,
>
> Tuesday, November 14, 2006, 11:57:37 AM, you wrote:
>
>>> #ifdef mingw32_HOST_OS
>>> if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND))
>>> return _sopen(file,how,_SH_DENYRW,mode);
>>> else
>>> return _sopen(file,how,_SH_DENYWR,mode);
>>> #else
>>> return open(file,how,mode);
>>> #endif
>
>> I haven't seen this code before, but I wonder if it's an attempt to
>> implement the single-writer multiple-reader locking semantics in the
>> Haskell 98 IO library?
>
> so, the first question: WHO wrote this? may be SOF?
Probably, yes.
> and second question: HOW this may help this semantics?? in my
> investigation, simple 'open' is just fine - it prevents
> writing by other
> processes to the file being written by Haskell program and it allow to
> read and write open by other processes of the file that i only read.
But does it allow the file to be opened for reading multiple times by the
current process? Perhaps that's the issue.
> may be it was problems on old windowses? and may be this some bug and
> this should be rewritten as DENY_WRITE and DENY_NONE, correspondingly
>
> btw, what is a semantics on Unix? is it the same as i mentioned above?
On Unix by default you can open a file as many times as you like, both for
reading and writing. To enforce any restrictions you have to use locks.
Cheers,
Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc