Improved file lock.

This commit is contained in:
Martin Edenhofer 2013-04-15 23:28:36 +02:00
parent 57d1d8288b
commit a6625c9467

View file

@ -68,12 +68,12 @@ module Session
File.open( session_file, 'rb' ) { |file| File.open( session_file, 'rb' ) { |file|
file.flock( File::LOCK_EX ) file.flock( File::LOCK_EX )
all = file.read all = file.read
file.flock( File::LOCK_UN )
begin begin
data = Marshal.load( all ) data = Marshal.load( all )
rescue rescue
return return
end end
file.flock( File::LOCK_UN )
} }
return data return data
end end