Bug #5350 » patch1.diff
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
|
||
}
|
||
##
|