From: Abhinav Saxena Date: 2009-09-11T19:08:23+09:00 Subject: Re: Global Mutex? --00504502cb242ef2de04734a0d42 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I used something like this using "ln -s" system command. Used to work great= , so if you want a simple approach and implementation you can use it. One catch: if the process which has the lock dies in between, you will have to ensure locks are properly released. BTW, "ln -s" approached worked with processes running on multiple machines as well. But yes, all the machines had access to a small common working directory. Thanks, Abhinav -- =E0=A4=85=E0=A4=AD=E0=A4=BF=E0=A4=A8=E0=A4=B5 http://twitter.com/abhinav On Wed, Aug 26, 2009 at 8:31 PM, Brian Candler wrote: > Aryk Grosz wrote: > > Is there any thing in ruby that acts as a global mutex? > > Between multiple processes on the same machine: I'd suggest using > File#flock on a local file (this probably won't work over NFS) with > File::LOCK_EX. You can include File::LOCK_NB if you want to test the > lock but not block if someone else has it. > > Between multiple processes on multiple machines: probably run a DRb > server one one machine which has a local mutex and yields back to the > caller. > -- > Posted via http://www.ruby-forum.com/. > > --00504502cb242ef2de04734a0d42--