Project

General

Profile

Bug #5350 » patch1.diff

Glass_saga (Masaki Matsushita), 09/23/2011 11:43 PM

View differences:

lib/weakref.rb
@@id_rev_map = {} # ref -> obj
@@mutex = Mutex.new
@@final = lambda {|id|
@@mutex.synchronize {
rids = @@id_map[id]
if rids
for rid in rids
@@id_rev_map.delete(rid)
end
@@id_map.delete(id)
end
rid = @@id_rev_map[id]
if rid
@@id_rev_map.delete(id)
@@id_map[rid].delete(id)
@@id_map.delete(rid) if @@id_map[rid].empty?
rids = @@id_map[id]
if rids
for rid in rids
@@id_rev_map.delete(rid)
end
}
@@id_map.delete(id)
end
rid = @@id_rev_map[id]
if rid
@@id_rev_map.delete(id)
@@id_map[rid].delete(id)
@@id_map.delete(rid) if @@id_map[rid].empty?
end
}
##
(2-2/3)