require "filelock" FileLock::LockedFile::open(__FILE__) do |fp| print fp.read fp.close end