Hello Simon, Tuesday, November 14, 2006, 2:31:17 PM, 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? >> 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. no problem at all. i even can read file modified by the same process >> 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. i.e. no sopen at all? in this case, other parts of library should make proper locking for unix. but for windows, the code above allow to EITHER multiple readers OR one writer. to allow multiple readers AND one writer simultaneously, it should be written as #ifdef mingw32_HOST_OS if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND)) return _sopen(file,how,_SH_DENYWR,mode); else return _sopen(file,how,_SH_DENYNO,mode); #else or just as 'open'. may be this looks too simple solution? :) -- Best regards, Bulat mailto:[EMAIL PROTECTED] _______________________________________________ Cvs-ghc mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/cvs-ghc