diff options
author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-14 14:35:50 +0000 |
---|---|---|
committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-14 14:35:50 +0000 |
commit | ed131ebad88c2948d7b40f93ff6ce39f1eb8a2f7 (patch) | |
tree | 7bbf62c5e0d0bb8ff971637cf432c6f16824f8f6 /lib/singleton.rb | |
parent | be1fea072cd0d22788ef8a931c0c6b64a2503b5d (diff) |
This commit was manufactured by cvs2svn to create tag 'v1_4_4'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_4_4@668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/singleton.rb')
-rw-r--r-- | lib/singleton.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/singleton.rb b/lib/singleton.rb index 8167a01aa8..235ba898fd 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -14,9 +14,15 @@ module Singleton def Singleton.append_features(klass) klass.private_class_method(:new) 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 |