From: Francis Cianfrocca Date: 2006-10-25T07:12:50+09:00 Subject: Re: File#flock as a cross-process mutex ------=_Part_10542_9255648.1161727966426 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/24/06, ara.t.howard@noaa.gov wrote: > > On Wed, 25 Oct 2006, Francis Cianfrocca wrote: > > > On 10/24/06, ara.t.howard@noaa.gov wrote: > >> > >> On Wed, 25 Oct 2006, Francis Cianfrocca wrote: > >> > >> > Has anyone wrapped up File#flock so it can used as a > >> platform-independent > >> > cross-process mutex? (I'm getting tired of writing the same code into > >> every > >> > app I do.) Or does anyone have a better idea? > >> > >> can you elaborate? do you need to yield the resource and re-aquire it? > > > > > > Most of the time I want to make sure only one process is running in a > > particular directory at a time. And if another one tries to start up, it > > should get an exception. And I also want it to be completely behaved in > the > > presence of both hangs and crashes. Sometimes I do need to yield and > > re-acquire, but I'm not looking for condition variables, just mutual > > exclusion. > > you might look at this > > http://rubyforge.org/frs/?group_id=1024&release_id=3473 > > http://codeforpeople.com/lib/ruby/lockfile/lockfile-1.4.0/ > > http://codeforpeople.com/lib/ruby/lockfile/lockfile-1.4.0/README > > > http://codeforpeople.com/lib/ruby/lockfile/lockfile-1.4.0/doc/rlock.help Thanks Ara. Some interesting ideas in there. I don't care for the outboard process or thread, but I'll give this a try. ------=_Part_10542_9255648.1161727966426--