src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb
def try_exclusive_lock
      File.open(@filename, 'w') do |f|
        if Fcntl.const_defined? :F_SETFD
          f.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
        end
        if f.flock(File::LOCK_EX | File::LOCK_NB)
          yield
        else
          raise AlreadyLocked
        end
      end
    end
# Try to obtain an exclusive lock on the lock file, similar to #exclusive_lock.
# But unlike #exclusive_lock, this method will raise AlreadyLocked if
# no lock can be obtained, instead of blocking.
#
# If a lock can be obtained, then the given block will be yielded.
Try to obtain an exclusive lock on the lock file, similar to #exclusive_lock.
But unlike #exclusive_lock, this method will raise AlreadyLocked if
no lock can be obtained, instead of blocking.

If a lock can be obtained, then the given block will be yielded.
Try to obtain an exclusive lock on the lock file similar to #exclusive_lock . But unlike #exclusive_lock this method will raise AlreadyLocked if no lock can be obtained instead of blocking . If a lock can be obtained then the given block will be yielded .
def try_exclusive_lock
      File.open(@filename, 'w') do |f|
        if Fcntl.const_defined? :F_SETFD
          f.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
        end
        if f.flock(File::LOCK_EX | File::LOCK_NB)
          yield
        else
          raise AlreadyLocked
        end
      end
    end
def try_exclusive_lock File . open ( @filename , 'w' ) do | f | if Fcntl . const_defined? :F_SETFD f . fcntl ( Fcntl :: F_SETFD , Fcntl :: FD_CLOEXEC ) end if f . flock ( File :: LOCK_EX | File :: LOCK_NB ) yield else raise AlreadyLocked end end end
Try to obtain an exclusive lock on the lock file, similar to #exclusive_lock.
Try to obtain an exclusive lock on the lock file similar to #exclusive_lock .