On Wed, 18 Aug 2004, Dan Janowski wrote: > Windows seems to exclusive lock when a file is opened for writing by > default. I have been unable to find a way around it. There cannot be a > reader, and then another process open the file for writing. > > I may have missed something, but maybe you need to only hold open a > file for writing. > > If this is not the case, or there is a way around it, I am interested > to know. i know nothing of windows but, in my case, i'm using posixlock to lock an empty nfs mounted semaphore file. i'm guessin the windows nfs client is that quite smart enough to know that some process on another machine is holding a lock... also LockFile exists for windows according to some of the source i've looked at... but, like i said, i know _nothing_ of windows. please enlighten if you have further comments! cheers. -a > > Dan > > > On Aug 17, 2004, at 22:50, Ara.T.Howard wrote: > >> On Wed, 18 Aug 2004, Rando Christensen wrote: >> >>> Ara.T.Howard wrote: >>>> require 'posixlock' >>>> def lock_test >>>> pid = Process.pid >>>> 42.times do >>>> open(__FILE__,'r+'){|f| f.posixlock(File::LOCK_EX) and puts >>>> "locked by <#{ pid }>"} >>>> end >>>> end >>>> fork ? lock_test && Process.wait : lock_test >>> >>> I don't have nfs to test on currently, but I assume this means it >>> worked? : >>> >>> vivi ~/src/posixlock-0.0.1 % ruby test.rb >>> locked by <1276> >>> locked by <1276> >> >> yup. >> >> thanks a bunch. mac __are__ nice i guess! now all i have to do is >> deal with >> the windows thing... >> >> regards. >> >> -a >> -- >> ======================================================================= >> ======== >> | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov >> | PHONE :: 303.497.6469 >> | A flower falls, even though we love it; >> | and a weed grows, even though we do not love it. | --Dogen >> ======================================================================= >> ======== >> > > > > -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen ===============================================================================