summaryrefslogtreecommitdiff
path: root/lib/weakref.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-27 09:49:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-27 09:49:34 +0000
commit77e876615da5f1482b225bd4f754b9fefcd52cec (patch)
tree27bc06133685cb3d4bcb75cfc81b3cda6cdf8e04 /lib/weakref.rb
parentf0ba57341ac7815189f7e33c980b8cbb51571efb (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/weakref.rb')
-rw-r--r--lib/weakref.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/weakref.rb b/lib/weakref.rb
index 9e510d6..459f69f 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -45,7 +45,13 @@ class WeakRef<Delegator
@__id = orig.__id__
ObjectSpace.define_finalizer orig, @@final
ObjectSpace.define_finalizer self, @@final
- ID_MAP[@__id] = [] unless ID_MAP[@__id]
+ __old_status = Thread.critical
+ begin
+ Thread.critical = true
+ ID_MAP[@__id] = [] unless ID_MAP[@__id]
+ ensure
+ Thread.critical = __old_status
+ end
ID_MAP[@__id].push self.__id__
ID_REV_MAP[self.id] = @__id
end