src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb
def shared_lock
      File.open(@filename, 'w+') do |f|
        if Fcntl.const_defined? :F_SETFD
          f.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
        end
        f.flock(File::LOCK_SH)
        yield
      end
    end
# Obtain an exclusive lock on the lock file, yield the given block,
# then unlock the lockfile. If the lock file was already exclusively
# locked by another process/thread then this method will
# block until the exclusive lock has been released. This method will not
# block if only shared locks have been obtained.
#
# The lock file *must* be writable, otherwise an Errno::EACCESS
# exception will be raised.
Obtain an exclusive lock on the lock file, yield the given block,
then unlock the lockfile. If the lock file was already exclusively
locked by another process/thread then this method will
block until the exclusive lock has been released. This method will not
block if only shared locks have been obtained.

The lock file *must* be writable, otherwise an Errno::EACCESS
exception will be raised.
Obtain an exclusive lock on the lock file yield the given block then unlock the lockfile . If the lock file was already exclusively locked by another process / thread then this method will block until the exclusive lock has been released . This method will not block if only shared locks have been obtained . The lock file * must * be writable otherwise an Errno :: EACCESS exception will be raised .
def shared_lock
      File.open(@filename, 'w+') do |f|
        if Fcntl.const_defined? :F_SETFD
          f.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
        end
        f.flock(File::LOCK_SH)
        yield
      end
    end
def shared_lock File . open ( @filename , 'w+' ) do | f | if Fcntl . const_defined? :F_SETFD f . fcntl ( Fcntl :: F_SETFD , Fcntl :: FD_CLOEXEC ) end f . flock ( File :: LOCK_SH ) yield end end
Obtain an exclusive lock on the lock file, yield the given block,
then unlock the lockfile.
Obtain an exclusive lock on the lock file yield the given block then unlock the lockfile .