Project

General

Profile

Bug #5355 » patch.diff

Glass_saga (Masaki Matsushita), 09/23/2011 11:53 AM

View differences:

lib/sync.rb
while true
@sync_mutex.synchronize do
if sync_try_lock_sub(m)
return self
else
if sync_sh_locker[Thread.current]
sync_upgrade_waiting.push [Thread.current, sync_sh_locker[Thread.current]]
sync_sh_locker.delete(Thread.current)
begin
if sync_try_lock_sub(m)
return self
else
sync_waiting.push Thread.current
if sync_sh_locker[Thread.current]
sync_upgrade_waiting.push [Thread.current, sync_sh_locker[Thread.current]]
sync_sh_locker.delete(Thread.current)
else
unless sync_waiting.include?(Thread.current) || sync_upgrade_waiting.reverse_each.any?{|w| w.first == Thread.current }
sync_waiting.push Thread.current
end
end
@sync_mutex.sleep
end
@sync_mutex.sleep
ensure
sync_waiting.delete(Thread.current)
end
end
end
    (1-1/1)