summaryrefslogtreecommitdiff
path: root/lib
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
parentf0ba57341ac7815189f7e33c980b8cbb51571efb (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/delegate.rb2
-rw-r--r--lib/weakref.rb8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/delegate.rb b/lib/delegate.rb
index 29f2a5d..480e1ef 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -39,7 +39,7 @@ class Delegator
raise
end
end
- EOS
+ EOS
end
end
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