vendor/bundle/gems/activesupport-3.2.13/lib/active_support/cache/file_store.rb
# Lock a file for a block so only one process can modify it at a time.
Lock a file for a block so only one process can modify it at a time.
Lock a file for a block so only one process can modify it at a time .
def lock_file(file_name, &block) 
          if File.exist?(file_name)
            File.open(file_name, 'r+') do |f|
              begin
                f.flock File::LOCK_EX
                yield
              ensure
                f.flock File::LOCK_UN
              end
            end
          else
            yield
          end
        end
def lock_file ( file_name , & block ) if File . exist? ( file_name ) File . open ( file_name , 'r+' ) do | f | begin f . flock File :: LOCK_EX yield ensure f . flock File :: LOCK_UN end end else yield end end
Lock a file for a block so only one process can modify it at a time.
Lock a file for a block so only one process can modify it at a time .
# :nodoc:
file_name
<not_specific>
block
<not_specific>