ロックシステムについて相談があるんですが i=0 begin File.open('lockfile',File::WRONLY|File::CREAT|File::EXCL,0666) do |lfile| File.open('hoge','r') do |file| # hogeを使ったいろいろな処理 end end File.unlink('lockfile') rescue SystemCallError if(i>10) then raise i+=1 if(File.stat('lockfile').mtime<Time.new+10) then File.unlink('lockfile') #残骸のロックファイル削除 else sleep(0.1) end retry end