summaryrefslogtreecommitdiff
path: root/lib/singleton.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-11-25 09:03:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-11-25 09:03:08 +0000
commitebab487fcd7633038b9272ddbe31c268cda15723 (patch)
treee7880ae217a2a58dbe35bcf0f94744bc03805e08 /lib/singleton.rb
parent8e48dc16e97a783a69f0972b4882ad2faae561ea (diff)
19991125
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/singleton.rb')
-rw-r--r--lib/singleton.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/singleton.rb b/lib/singleton.rb
index 4aea574..2785c77 100644
--- a/lib/singleton.rb
+++ b/lib/singleton.rb
@@ -17,7 +17,12 @@ module Singleton
@__instance__ = nil
def instance
unless @__instance__
- @__instance__ = new
+ Thread.critical = true
+ begin
+ @__instance__ = new
+ ensure
+ Thread.critical = false
+ end
end
return @__instance__
end