diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-03-02 03:51:50 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-03-02 03:51:50 +0000 |
commit | 58e68a3660c47739d7a70cc6f5cdebec030502d2 (patch) | |
tree | e66bc7e98dd9a64d633af4220bcae7e63994e1b8 /lib | |
parent | 58dd5de9664c57d72b45fd90a75f08fab506f208 (diff) |
2000-03-02
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pstore.rb | 4 | ||||
-rw-r--r-- | lib/singleton.rb | 7 | ||||
-rw-r--r-- | lib/weakref.rb | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/lib/pstore.rb b/lib/pstore.rb index 0f37491baf..97b3794326 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -52,6 +52,10 @@ class PStore in_transaction @table[name] = value end + def delete(name) + in_transaction + @table.delete name + end def roots in_transaction diff --git a/lib/singleton.rb b/lib/singleton.rb index 4aea574e7a..235ba898fd 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -16,8 +16,13 @@ module Singleton klass.instance_eval %{ @__instance__ = nil def instance + Thread.critical = true unless @__instance__ - @__instance__ = new + begin + @__instance__ = new + ensure + Thread.critical = false + end end return @__instance__ end diff --git a/lib/weakref.rb b/lib/weakref.rb index c6fe8cd21b..18b530f2ae 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -40,7 +40,7 @@ class WeakRef<Delegator ObjectSpace.call_finalizer orig ObjectSpace.call_finalizer self ID_MAP[@__id] = [] unless ID_MAP[@__id] - ID_MAP[@__id].concat self.__id__ + ID_MAP[@__id].push self.__id__ ID_REV_MAP[self.id] = @__id end |